如何在 Zend 框架中使用 Join [英] How to use Join in Zend Framework
问题描述
我在 Zend 中使用 Join 查询..喜欢
i am using Join query in zend.. like
$select = $table->select()
->from(array('e' => 'EducationHistory'),
array('status_DataDictionary_id'))
->join(array('r' => 'ReportOrder'),
'e.id = r.EducationHistory_id',
array('reportOrderStatusId' => 'r.status_DataDictionary_id'))
->where('r.orderBy_Organization_id = ?', 4)
->where('r.orderBy_Person_id = ?', 1)
->group('e.enrollno');
为了做到这一点,我得到了帮助http://framework.zend.com/manual/en/zend.db.select.html
and to do that i take help from http://framework.zend.com/manual/en/zend.db.select.html
但是当我尝试运行该查询时,会出现一个错误,提示我
but when i try to run that query an error occurs which say me that
选择查询不能与另一个连接
Select query cannot join with another
谁能帮帮我.?提前致谢.... :)
could any one help me.? Thanks in advance.... :)
表格
推荐答案
因为 Zend_Db_Table 提供了行网关功能,如果你加入其他表就行不通,你必须声明你愿意放弃它.只需调用 setIntegrityCheck 即可:
Because Zend_Db_Table provides row gateway functions, which don't work if you join on other tables, you have to state that you are willing to give it up. Simply make a call to setIntegrityCheck and it will work:
$select->setIntegrityCheck(false);
这篇关于如何在 Zend 框架中使用 Join的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!