Very cool, David. Thanks!

On Wed, Mar 9, 2011 at 7:57 PM, David Muir [via Zend Framework
Community] <[email protected]> wrote:
> Not all databases support implicit joins, so you need to convert it to
> explicit joins.
> So instead of:
> SELECT parent.name
> FROM nested_category AS node,
> nested_category AS parent
> WHERE node.lft BETWEEN parent.lft AND parent.rgt
> AND node.name = 'FLASH'
> ORDER BY parent.lft;
>
> You'd have:
> SELECT parent.name
> FROM nested_category AS node
> JOIN nested_category AS parent ON (node.lft BETWEEN parent.lft AND
> parent.rgt)
> WHERE node.name = 'FLASH'
> ORDER BY parent.lft;
>
> Which is quite straight forward to convert to Zend_Db_Select:
> $select = $db->select();
> $select->from(array('node' => 'nested_category'), array('parent.name'))
>     ->join(array('parent' => 'nested_category'), 'node.lft BETWEEN
> parent.lft AND parent.rgt')
>     ->where('name.name=?', 'FLASH')
>     ->order('parent.lft');
>
> Cheers,
> David
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Db-Select-with-multiple-from-s-tp3344822p3344961.html
> To unsubscribe from Zend_Db_Select with multiple from's, click here.



-- 


//
Corey H Maass
Gelform
Web app design and development.
Brooklyn, NY
em [email protected]
ww http://gelform.com
ph 646/228.5048
fx 866/502.4861
IM gelform
tw http://twitter.com/coreymaass
fb http://facebook.com/coreymaass


--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Db-Select-with-multiple-from-s-tp3344822p3345045.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to