Code Igniter Left outer Join

Manoli

So this is the query I am not sure how to write on code igniter. I want to put my "And" statement before the where. The query works, but I do not know the syntax of it in code igniter. Any help will be appreciated, Thank you.

Select c.c_id, c.c_name, p.phone_no FROM Company AS c 
LEFT OUTER JOIN Phone AS p
ON p.p_flex_id=c.c_id
AND p.g_id'='1' AND p.ct_id='3'
WHERE 1
fmgonzalez

I think with ActiveRecord sintax it could be something like that

$this->db->select('Company.c_id, Company.c_name, Phone.phone_no')
   ->from('Company')
   ->join('Phone','Phone.p_flex_id=Company.c_id AND Phone.ct_id=3','left outer' )
   ->where(1);

I hope it works fine for you.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related