I use this codes. I want check if budget < 0 select it.
$criteria = new CDbCriteria;
$criteria->select = array('*', 'SUM(amount) as budget');
$criteria->group = 'user_id';
$debtors = Transactions::model()->findAll($criteria);
How can i add this condition?
use
$criteria = new CDbCriteria;
$criteria->select = array('*', 'SUM(amount) as budget');
$criteria->having = 'budget < 0 ' ;
$criteria->group = 'user_id';
$debtors = Transactions::model()->findAll($criteria);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.