• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run Left Join With Using

#1
[eluser]Unknown[/eluser]
I need to run this statement with Active Record, but I do not know how to use:
Code:
SELECT a.id, a.desc
FROM table1 a
B LEFT JOIN table2 USING (id)
WHERE IS NULL b.id

#2
[eluser]CodeIgniteMe[/eluser]
Code:
$this->db->select('a.id, a.desc')
->from('table1 a')
->join('table2 b','a.id=b.id')
->where('is null b.id')

Also take note, old-style/traditional join is better than the joins available now simply because, not all SQL driven databases support/ has the same syntax of joins, and all (theoretically) SQL driven databases support old-style/traditional joins

#3
[eluser]jmadsen[/eluser]
Fine to use Active Record, but why do you feel you need it?

http://ellislab.com/codeigniter/user-gui...mples.html


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.