So Zend_db_select has the methods
`joinUsing(table, join, [columns]) and joinInnerUsing(table, join, [columns])`
`joinLeftUsing(table, join, [columns])`
`joinRightUsing(table, join, [columns])`
`joinFullUsing(table, join, [columns])`
etc
but what if you want to join 3 or more tables (eg for a many to many association)....eg: this query:
SELECT * FROM (j LEFT JOIN e ON j.id = e.eee) LEFT JOIN w ON w.www = e.id
how would you go about doing this开发者_如何学编程 with zend_db_select
Try doing ... but i am not so sure works with two fields but have not tried with 3 fields
$dbmodel->select(false)
->setIntegrityCheck(false)
->from(array('t1' => 'table1'))
->joinLeft(array('t2' => 'table2'),
't1.somefeild = t2.somefeild')
->joinLeft(array('t3' => 'table3'),
't2.somefeild = t3.somefeild')
you try to build query, and also you can check query by die((string)$select)
Try use subquery and Zend_Db_Expr. Read more here.
精彩评论