开发者

codeigniter multiple join conditions on same table

Basically i want to join开发者_如何学Python a table where a col in table A matches a col in table B and where a col in table B is equal to 0. I am using codeigniters active record class.

Thanks in advance.


Something like this should work:

$this->db->join('B', 'aCol = bCol AND bOtherCol = 0');
$this->db->get('A');

Optionally, a third argument can be specified for the join method to indicate whether a left or right join should be performed. For example, to perform a left join:

$this->db->join('B', 'aCol = bCol AND bOtherCol = 0', 'left');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜