标签:des style blog io ar color sp 数据 on
方法一:这种方法有个坑儿,就是as 后面的别名,必须是属性范围内的名字。
$criteria = new CDbCriteria(); $criteria->select = ‘sum(amount) total‘; $criteria->order = ‘wom_id desc’; $criteria->addCondition(“wom_id=4");//也可以$criteria->condition = "$wom_id=4"; $aResult = Member::model()->findAll($criteria);
方法二:
//获取账户已到帐总额 public static function GetAmountAlreadyArrive($int_wom_id){ $connection = Yii::app()->weimob_payment; $str_sql = "select sum(`ww_amount`) as `total_balance` from `t_wm_weimobpay_withdrawal_new`"; $str_sql .= " where wom_id={$int_wom_id} and ww_pay_status=1 and ww_check_status=1"; $command = $connection->createCommand($str_sql); return $command->queryAll(); } //获取账户提现总额 public static function getCashamount($int_wom_id){ $connection = Yii::app()->weimob_payment; $str_sql = "select sum(`ww_amount`) as `total_balance` from `t_wm_weimobpay_withdrawal_new`"; $str_sql .= " where wom_id={$int_wom_id} and ww_check_status!=2"; $command = $connection->createCommand($str_sql); return $command->queryAll(); }
标签:des style blog io ar color sp 数据 on
原文地址:http://www.cnblogs.com/sungx/p/4122536.html