2008年11月21日星期五

[fw-db] Nested SELECT statements in $select->from

Is there a way to do the following SQL:

SELECT * FROM (SELECT * FROM `table1` AS `t1` WHERE t1.catID = 5) AS
`tmp` WHERE tmp.body LIKE '%searchword%'

(specifically the nested SELECT in the FROM) using the object
interface of the Zend_Db_Select object? I've got a SQL query that is
more complicated than the above but in straight SQL is made much
simpler using nested SELECT. I'd like to use Zend_Db_Select as it
makes building SQL statements so much nicer when generating SQL with
code.

Chris

没有评论: