我想跳过foreach
循环;
如何sum
使用 yii 查询获得?
$sql = 'select size_kb from comp_arch_stats where company_id = ' . ($model->company_id) . ' and arch_month = ' . $month . ' and arch_year = ' . $year . ';';
$val = Yii::app()->db->createCommand($sql)->queryAll();
$sum = 0;
foreach ($val AS $result) {
$sum += $result['size_kb'];
}