我需要编辑我的 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'
为什么这样?