MANY_MANY ambiguous

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(











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 FROM tbl_division t LEFT OUTER JOIN tbl_person_division people_people ON ( LEFT OUTER JOIN tbl_person people ON ( WHERE (id=:id)

how can I resolve it?

Had a similar problem…

try to do


thank you very much.

Maybe I’m doing the wrong things: I’ve Division and Person, they have a many to many relation (people and divisions), I’ve the ID of the division and I want to pick up all the people inside it. It’s stupid but I don’t understand how to do it and put inside a dataprovider for the gridView