Yii CDbCriteria error: Column 'id' in where clause is ambiguous

I have a problem.

I use the ext.ecolumns.EColumnsDialog and when in these fields enters a value filter it works fine, except for id. When you type anything at id, whether true or false it receives something on the principle of alert () coming from javascript. This alert contains the text:

    Error 500: <h1>CDbException</h1>

    <p>CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous. The SQL statement executed was: SELECT COUNT(DISTINCT `t`.`id`) FROM `table_test` `t`  LEFT OUTER JOIN `two_table` `twotables` ON (`t`.`two_table`=`twotables`.`id`)  LEFT OUTER .....

How can I fix this error? I tried to add now


$criteria->compare('t.id', $this->id);

` or similar.


my controller file:

    $model = new Model_name('search');


            $model->unsetAttributes();  // clear any default values


            if (isset($_GET['Model_name'])){


                $model->attributes = $_GET['Model_name'];




            $this->render('admin', array(

                'model' => $model,


my Model file:

     public function search()


         $criteria = new CDbCriteria;



    $criteria->params = array(":id"=>$this->id);



            return new CActiveDataProvider($this, array(

                'criteria' => $criteria,

                'sort' => $sort,

                'pagination' => $pages


I changed Model name and controller because doesn’t wish to disclose:)

The same error also receives such solutions id (other columns of course work)


$criteria->params = array(":id"=>$this->id);

$criteria->compare('table_test.id', $this->id);

$criteria->compare('t.id', $this->id);

or similar. :rolleyes: