how can i write this sql query in 开发者_高级运维cakephp
select name from coupons as c where c.created=(select max(c2.created) from coupons as c2);
In this case, maybe you actually mean this:
$this->Coupon->find('first', array('order' => array('Coupon.created' => 'desc')));
For real subqueries, see the manual under Subqueries.
精彩评论