06-21-2011, 02:13 AM
[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:
If you could help me, that would be great. Thanks!
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!