如何使用CodeIgniter INNER JOIN 3表 [英] How to INNER JOIN 3 tables using CodeIgniter

查看:118
本文介绍了如何使用CodeIgniter INNER JOIN 3表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何加入3表与PHP吗?
示例

Can someone Tell me how to join 3 table with php? Example

SELECT FROM table1, table2,table on INNERJOIN -------------------

让我有3个表(问题表,答案表和类别

let I have 3 table.(question table ,answer table and category table) Here is example form my webpage.

Time remaining 30 minutes(I will get "30 minutes" form Category table)
1. Question (from question table)
2. answer (from answer table)


b $ b

我不知道如何加入3表。

I don't know how to join 3 table.

推荐答案

p>

it should be like that,

$this->db->select('*');    
$this->db->from('table1');
$this->db->join('table2', 'table1.id = table2.id');
$this->db->join('table3', 'table1.id = table3.id');
$query = $this->db->get();

根据CodeIgniters活动记录框架

as per CodeIgniters active record framework

这篇关于如何使用CodeIgniter INNER JOIN 3表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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