开发者

self join using cakephp

开发者 https://www.devze.com 2023-02-07 22:06 出处:网络
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);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消