Join more than two tables in codeigniter

*爱你&永不变心* 提交于 2019-12-24 00:44:22

问题


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



来源:https://stackoverflow.com/questions/5743295/join-more-than-two-tables-in-codeigniter

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!