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(

		'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?

Had a similar problem…

try to do


 'condition'=>'`t`.id=:id',

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