• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple db join on same table

#1
[eluser]Wonder Woman[/eluser]
Hi there,

I have a news article database table which I have stored the id of a user in it twice, once for the author and secondly for who modified the article. So I need to do a multiple join but its not working properly.

My code is:

Code:
$this->db->select('*, news.id as news_id, news.created as created_on');
$this->db->from('news');
$this->db->join('users', 'users.id = news.author and users.id = news.modified_by', 'left');
$this->db->get();

If you could help me, that would be great. Thanks!


Messages In This Thread
Multiple db join on same table - by El Forum - 06-21-2011, 02:13 AM
Multiple db join on same table - by El Forum - 06-21-2011, 02:51 AM
Multiple db join on same table - by El Forum - 06-21-2011, 03:01 AM
Multiple db join on same table - by El Forum - 06-21-2011, 03:09 AM
Multiple db join on same table - by El Forum - 06-21-2011, 03:11 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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