[eluser]Anil3a[/eluser]
Hello i want to retrieve data from one table comparing with another table. Its like ..... selecting * from TABLE_ONE .... but not the rows that are .... TABLE_ONE_ID = TABLE_TWO_ID.
The TABLE_ONE has ids that are in TABLE_TWO but TABLE_TWO doesn't have ids that are in TABLE_ONE.
I tried this one but did not worked..
Code:
SELECT * FROM gift WHERE gift.gift_id NOT IN (select * from trans where trans_id = $trans_id) ORDER BY gift_id ASC');
where $trans_id is an array of ids that are in trans.
Also tried this one but it does not worked too.
Code:
$this->db->select('*');
$this->db->from('gift');
$this->db->join('trans', 'trans.trans_id = gift.gift_id');
$query = $this->db->where_not_in('gift_id', $trans_ids);