2009年4月24日星期五

Re: [fw-db] Joining 2 tables

I notice that you specified two column names is the join method's third
argument: array('user_ID','user_Name')

Remember there are subtle differences between the Zend_Db_Select and the
Zend_Db_Table_Select. One of those differences is that you can not include
columns from the joined table in the result using the Zend_Db_Table_Select.
(15.5.8.1. Select API)

Create a Zend_Db_Select object from the db
adapter(http://framework.zend.com/manual/en/zend.db.select.html)


CEHTURK wrote:
>
> Hi all,
>
> I am trying to join two tables but I could not figure out how to do that.
> My
> code is below. Any help is appriciated.
>
> Thanks
>
> $auth = Zend_Auth::getInstance();
> $user = $auth->getIdentity();
> $id = $user->user_ID;
> $inbox = new Inbox();
> $select = $inbox->select()
>
> ->from(array('mail_Inbox'=>'mail_Inbox'),array('messageID','receiverID','senderID','date','messageTitle','message','messageRead'))
>
> ->join(array('dict_Alumni'=>'dict_User'),'mail_Inbox.senderID=dict_User.user_ID',array('user_ID','user_Name'))
> ->where('mail_Inbox.receiverID = ?',$id);
> $this->view->inbox = $inbox->fetchAll($select);
>
> Then it returns error...
>
> Any ideas welcome
>
> Erdal YAZICIOGLU
> Field Project Engineer Manager
> Page Europa
> A GENERAL DYNAMICS COMPANY
> Ras Laffan Industrial City
> Doha, Qatar
> Mobile: +974 325 4429
>
>
>

--
View this message in context: http://www.nabble.com/Zend_Db_Table_Abstract-question-II.-tp23100795p23217325.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: