Zend Framework Db 选择连接表帮助 [英] Zend Framework Db Select Join table help
本文介绍了Zend Framework Db 选择连接表帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个查询:
SELECT g.title, g.asin, g.platform_id, r.rank
FROM games g
INNER JOIN ranks r ON ( g.id = r.game_id )
ORDER BY r.rank DESC
LIMIT 5`
现在,这是我使用 Zend_Db_Select
的 JOIN 但它给了我数组错误
Now, this is my JOIN using Zend_Db_Select
but it gives me array error
$query = $this->select();
$query->from(array('g' => 'games'), array());
$query->join(array('r' => 'ranks'), 'g.id = r.game_id', array('g.title', 'g.asin', 'g.platform_id', 'r.rank'));
$query->order('r.rank DESC');
$query->limit($top);
$resultRows = $this->fetchAll($query);
return $resultRows;
有人知道我做错了什么吗?我想显示游戏"中的所有列以及排名表中的排名"列.
Anyone know what I could be doing wrong? I want to get all the columns in 'games' to show and the 'rank' column in the ranks table.
推荐答案
我假设您已经解决了这个问题,但最好将答案留给其他人.
I am going to assume you've solved this, but it would be nice to leave the answer for others.
在选择对象的实例化下面添加这个.
Add this below the instantiation of the select object.
$query->setIntegrityCheck(false);
这篇关于Zend Framework Db 选择连接表帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文