I don't know if its possible but I'd like to make it a Zend_Db_Select object and I don't know how
SELECT *
FROM MyTable MT1
WHERE MT1.date = (
SELECT MAX(MT2.date)
FROM MyTable MT2
)
I don't know if its possible but I'd like to make it a Zend_Db_Select object and I don't know how
SELECT *
FROM MyTable MT1
WHERE MT1.date = (
SELECT MAX(MT2.date)
FROM MyTable MT2
)
Maybe something like that would 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() .')' )
);