$models = City::model()->findAllBySql("select cit.cit_code, cit_name, COUNT(adv.adv_code) AS advcounter from city AS cit, advert AS adv where cit.cit_code = adv.cit_code GROUP BY cit.cit_code ORDER BY cit_name ASC");

$models = City::model()->findAllBySql("select cit.cit_code, cit_name, COUNT(adv.adv_code) AS advcounter from city AS cit, advert AS adv where cit.cit_code = adv.cit_code GROUP BY cit.cit_code ORDER BY cit_name ASC");