Mysql MAX函数无法使用yii中的select函数
$command = Yii::app()->db->createCommand()
->select("MAX(modified_date) AS MDATE,storage_path")
->from("engine4_storage_files")
->where("user_id=:user_id AND type='thumb.normal'", array(':user_id'=>$user_id))
->queryRow();
print_r($command);
exit;
请帮帮我
由于
答案 0 :(得分:0)
try this example:
$model = new Model;
$criteria=new CDbCriteria;
$criteria->select='max(column) AS maxColumn';
$row = $model->model()->find($criteria);
$somevariable = $row['maxColumn'];
您也可以按照此参考: