简体   繁体   中英

Join more than two tables in codeigniter

I have 4 tables and i want to join there tables together in codeigniter. Is it possible with codeigniters join method?

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');

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM