i try for several hours to specify a CDbCriteria for counting entrys with the same value.
i want have something like this:
SELECT artist.name, count(artist.name) FROM concerts LEFT OUTER JOIN artists artist ON (artists_id=artist.id) GROUP BY artist.name
I tried to do it with this code:
$criteria = new CDbCriteria; $criteria->with = array('artist'); $criteria->group='artist.name'; $criteria->select ='artist.name,count(artist.name)';
when i use this CDbCriteria i get this error:
Active record "Concert" is trying to select an invalid column "artist.name". Note, the column must exist in the table or be an expression with alias.
anyone has a idea how to use GROUP BY & COUNT() in combination with a CDbCriteria?