使用codeigniter活动记录的多个on子句

时间:2012-11-16 13:02:51

标签: codeigniter left-join on-clause

我需要使用codeigniter活动记录对左连接查询执行多个on子句。 我写这段代码:

$this->db->join('table1', 'table1.col1 = table2.id', 'left');
$this->db->where_not_in('table.col2', $list);

通过执行此codeigniter添加where in not子句,而我需要添加一个与左连接相关的ON子句。 如果有可能我想使用有效记录。

1 个答案:

答案 0 :(得分:1)

$this->db->join('table1', 'table1.col1 = table2.id AND col2 NOT IN ('.implode(',', $list).')', 'left');