如何在 Zend Framework 中使用 Join
我正在 zend 中使用 Join 查询.. 我喜欢
$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
但是当我尝试运行该查询时出现错误,这告诉我
选择查询无法与另一个查询连接
任何人都可以帮助我吗? 提前致谢.... :)
表格
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');
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.... :)
table
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为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: