如何在Zend Framework中使用Join [英] How to use Join in Zend Framework

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

问题描述

我在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 Framework中使用Join的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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