codeigniterleft-joinon-clause

Multiple on clause using codeigniter active record


I need to do a multiple on clause on a left join query using codeigniter active record. I write this code:

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

by doing this codeigniter add where not in clause, while I need to add a ON clause, related to the left join. If it's possible I would like to use active records.


Solution

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