I need to create the following query (this is just an example) using Zend Framework 1.12 as part of a larger query:
SELECT `s`.*
FROM `s`
INNER JOIN SELECT id FROM table where id = 13 AS `t`
Here's my attempt:
$query = $this->getDbTable()->select()
->from($this->getDbTable(), array('*'))
->join(array('t' => new Zend_Db_Expr('(SELECT id FROM tables where id = 13)')), array())
->setIntegrityCheck(false);
However, this is the output:
SELECT `students`.*, `t`.*
FROM `students`
INNER JOIN SELECT id FROM tables where id = 13 AS `t`
I do not require the t.*
from the select since the t
table will be used in other ways within the complex query.
Do you know how not to select the t.*
but still have the inner join using the subquery?