I have 4 tables and i want to join there tables together in codeigniter. Is it possible with codeigniters join method?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If you are using CodeIgniter's Active Record class, you can just use the join
method multiple times to join multiple tables.
$this->db->join('table2', 'table2.ID = table1.ID');
$this->db->join('table3', 'table3.ID = table1.ID');
$this->db->join('table4', 'table4.ID = table1.ID', 'left');
回答2:
I assume that you are talking about joining SQL database tables, is this correct? If so you can always use the CodeIgniter SQL method, see: http://codeigniter.com/user_guide/database/queries.html