【发布时间】:2014-07-16 13:04:47
【问题描述】:
我有一个连接语句,它从具有 TeamID 的团队表中连接 HomeID 和 AwayID。当我连接这两个表时,它只返回最后一个连接语句的值。这是我的模型:-
function get_fixtures(){
$where=array(
'gameweek'=>1,
);
$this->db->select();
$this->db->from('matches AS M');
$this->db->join('team AS T2', 'T2.teamID=M.awayClubID' );
$this->db->join('team AS T1', 'T1.teamID=M.homeClubID');
$this->db->where($where);
$query = $this->db->get();
return $query->result_array();
}
当我打印出结果时,它只返回 T1 结果。如果有人可以提供帮助将不胜感激:-)
【问题讨论】:
-
尝试使用
echo $this->db->last_query();打印sql
标签: php mysql sql codeigniter activerecord