Can I force Yii to use particular alias in generated SQL
问题 I'm retrieving my records using CActiveRecord with a with() statement: Probes::model()->with(array ( 'user', 'results', 'results.answer', 'survey', 'survey.questions' ))->findByPk($id) I wanted to use GROUP BY on question_id field of survey.questions relation, so I changed above to: 'survey.questions'=>array('group'=>'survey.questions.question_id'), This caused a SQL exception 1054 Unknown column . However, by analyzing attached SQL code: `questions`.`question_id` AS `t6_c2` I managed to find