比如文章列表页面,我要实时统计每条记录的评论数,下面配置要怎么改才行,现在总是报错
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1140 Mixing of GROUP columns (MIN(),MAX(),COUNT(),…) with no GROUP columns is illegal if there is no GROUP BY clause
我的relation配置
public function relations()
{
return array(
'Comments' => array(self::HAS_MANY , 'Comments' , 'ART_ID', 'select'=>'COUNT(COMMENT_ID) AS TOTALS'),
);
}