Join and where condition in codeigniter

 


It's been a while since I wrote CI, but as per this docs page, your solution might look like this:

$this->db->select('*');
$this->db->from('table1');
$this->db->join('table2', 'table1.col1 = table2.col1');
$this->db->where('table1.col1', 2);

$query = $this->db->get();

note this answer is in no way to be construed as an endorsement of working with Code Igniter ;-)

Comments

Popular posts from this blog