2010年1月6日星期三

[fw-db] Join within a join in zend_db_select

I'm creating a select to hand to zend_paginator. My SQL request has a join
within a join and I'm not sure how to build a select with this.

I want to get all CD's, the artist of the cd, and the city and country of
the artist.

SELECT cds.*, artists.Name, artists.City, countrys.Name as "Country"
FROM cds
INNER JOIN artists
ON cds.Artist=artists.Id
LEFT JOIN countrys
ON artists.Country=countrys.Id;

I've been referencing the documentation but nothing I've tried has worked.
http://framework.zend.com/manual/en/zend.db.select.html

Thanks!

Corey
--
View this message in context: http://n4.nabble.com/Join-within-a-join-in-zend-db-select-tp1008200p1008200.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: