I have a relation MANY to MANY from the tables ‘division’ and ‘person’, ‘divison’ relation is ‘people’.
I write this part of code to obtain all the people that work inside one division and put it in the gridView
$dataProvider=new CActiveDataProvider('division', array(
'criteria'=>array(
'condition'=>'id=:id',
'params'=>array(':id'=>23),
'with'=>array('people'),
),
'pagination'=>array(
'pageSize'=>20,
),
)
);
the browser says:
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 tbl_division
t
LEFT OUTER JOIN tbl_person_division
people_people
ON (t
.id
=people_people
.division_id
) LEFT OUTER JOIN tbl_person
people
ON (people
.id
=people_people
.person_id
) WHERE (id=:id)
how can I resolve it?