表A中的位置,但CodeIgniter中不是B.

i am using codeigniters sql selection to select users where not in a set of id's.

$this->db->select('fbuid')->where_in('fbuid', $friends);
$query   = $this->db->get('users');

im am trying to add another clause where it check for and not in friends table (id column). im trying to add use

$this->db-where_not_in

but i can't seem to get it to work

heres a pseudocode sql statement

SELECT fbuid FROM users WHERE IN () BUT NOT IN the friends TABLE ID COLUMN

Try this:

$query = $this->db->select('fbuid')
         ->from('users')
         ->where_in('fbuid', $friends)
         ->where_not_in('fbuid', $otherFriends);

EDIT:

You can either make a subquery before and store it in array OR do this in one step:

$query = $this->db->select('fbuid')
             ->from('users')
             ->where_in('fbuid', $friends)
             ->where('`fbuid` NOT IN (SELECT `uid` FROM `another_table`)', NULL, FALSE);

NULL, FALSE are important.