How do I create a Zend_Db_Select with nested queries?
2 answers
Perhaps something like this will work:
$nestedSelect = $db->select()->from(
array('MT2' => 'MyTable'),
new Zend_Db_Expr('MAX(MT2.date)')
);
$select = $db->select()->from(
array('MT1', 'MyTable')
)->where(
'MT1.date = ?', new Zend_Db_Expr('(' . $nestedSelect->toString() . ')')
);
+2
a source to share
You can also do this by simply replacing the subquery variable ( $this->select()
) in the main query (more: fooobar.com/questions/190125 / ... )
0
user216084
a source
to share