ZH奶酪:Yii PHP sum SQL查询语句

例子:

$sql = 'SELECT SUM(o.price) as `sum`
FROM `order` o
WHERE o.customer_id ='.$profile->id;

$ret = Yii::$app->db->createCommand($sql)->queryScalar();
posted @ 2015-06-16 10:28  ZH奶酪  阅读(504)  评论(0编辑  收藏  举报