我需要编辑CGridView的查询
所以在我的模型中我改变了函数search(),如下所示:
$criteria=new CDbCriteria;
$criteria->select = "links.title, links.url, groups.title as grouptitle";
$criteria->join = " join groups on links.id_group = groups.id_group";
$criteria->addCondition("links.id_user = '" . Yii::app()->user->getId() . "'");
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
但是从我的观点来看,我收到一条错误,告诉我选择不正确:
The SQL statement executed was: SELECT COUNT(*) FROM `links` `t` join groups on links.id_group = groups.id_group WHERE links.id_user = '1'
为什么呢?