1
我有三個表爲笨的活動記錄不返回預期的結果
+----------+ +-------------+
| adv | | removed_adv |
+==========+ +=============+
| id | | id |
| group | | adv_id |
| category | | member_id |
| title | +-------------+
| path |
| duration |
+----------+
我想從進階表中的數據對於一個給定組和類別。但是如果removed_adv.advid = adv.id,結果集不應包含廣告。我試過以下。它返回所有的記錄,而不filtering by $this->db->where_not_in('adv.id', 'ids from removed_adv');
$this->db->select('*');
$this->db->from('adv');
$this->db->where_not_in('adv.id', 'ids from removed_adv');
$this->db->where_in(array(
'category' => $cat_id,
'group' => $group_id
));
return $this->db->get();