I have a model Aziende, that is related (1:N) to anther model called Annunci, like this:
'annunci' => array(self::HAS_MANY,'Annunci','azienda_id'),
I would like to count how many record does really have this relation, in mySql I will do:
SELECT count( * )
FROM `aziende` a
JOIN annunci an ON an.azienda_id = a.id
How can i do this with Yii AR Model?
PS: I tried to look out conditional query, but i can't find my way.