Zend_Db_Select Subquery
Hello,
I'm some kind newbie in zend framework but I need to know if I can do this:
I have a query like this:
SELECT
tmp.x,
tmp.y
FROM
(
SELECT a as x, b as y FROM table_a WHERE ... GROUP BY ...
) AS tmp
WHERE
........
GROUP BY
.......
I use Zend_DB_Select to build this quey, but I can't include that subquery in my build.
This is the php code I use (where $select is the Zend_Db_Select object)
$tmp_table = "SELECT a as x, b as y FROM table_a WHERE ... GROUP BY ...";
$select->from(array('tmp' => $tmp_table), "x");
$select->from(null, "y");
.................
Please let me know if anyone made something like this, or how U solve this type of queryes with Zend_Db
Thank you,
and excuse my english.
|