Thanks so much for your relentless help Bill - you are a star!!!
What is the essence of the empty array declarations in your code? Besides
the code doesnt run. It returns a blank page.
Bill Karwin wrote:
>
>
> dele454 wrote:
>>
>> The table join on this model only works up until event. How can i connect
>> the AreaID from the event table to that of Area, then from Area to City
>> to complete the join ...
>>
>
> Your query is this:
>
> SELECT e.eventName, v.VenueName, c.City
> FROM EventVenue ev
> LEFT JOIN Event e ON ev.eventid=e.eventid
> LEFT JOIN Venue v ON ev.venueid=v.venueid
> LEFT JOIN Area a ON e.areaid=a.areaid
> LEFT JOIN City c ON a.cityid=c.cityid;
>
> Here's how I'd write it using the select interface:
>
> $sql = $this->select()->setIntegrityCheck(false)
> ->from($this, array() )
> ->joinLeftUsing( array('e'=>'Event'), 'EventId', array('EventName') )
> ->joinLeftUsing( array('v'=>'Venue'), 'VenueId', array('VenueName') )
> ->joinLeft( array('a'=>'Area'), 'e.AreaId = a.AreaId', array() )
> ->joinLeft( array('c'=>'City'), 'a.CityId = c.CityId', array('City')
> );
>
> It seems that Zend_Db_Select::joinLeftUsing() assumes that you're joining
> to the first table in the FROM clause. It produces SQL with a standard
> equi-join instead of the USING clause. I've logged a bug for this:
> http://framework.zend.com/issues/browse/ZF-3792
>
> Regards,
> Bill Karwin
>
-----
dee
--
View this message in context: http://www.nabble.com/Using-the-Zend_Db_Table-to-return-referenced-row-values-tp18688983p18721757.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论