在codeigniter中加入两个以上的表 [英] Join more than two tables in codeigniter

查看:111
本文介绍了在codeigniter中加入两个以上的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有4个表,我想在codeigniter一起加入表。

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

推荐答案

如果您使用的是CodeIgniter的活动记录类,您只需使用加入方法多次连接多个表。

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

这篇关于在codeigniter中加入两个以上的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆