下面的Yii模型方法應該返回2個值,名稱和描述,每個記錄,而只是返回描述。當直接在MySQL中執行時,相同的查詢完美工作。 Yii是否阻止其中一個連接被執行?爲什麼yii從雙內連接的查詢中省略值?
public function reportEducation(){
$criteria = array(
'select' => "
concat(person.name_first," ",person.name_last),
group_concat(person_studylevel.description)",
'join' => "
inner join person on junior = person.id
inner join person_studylevel on level = person_studylevel.id",
'group by' => 'junior'
);
return PersonEducation::model()->findAll($criteria);
}
這是我的查詢:它
select
concat(person.name_first," ",person.name_last) as name,
group_concat(person_studylevel.description separator ", ")
from person_junior_education
left join person on junior = person.id
left join person_studylevel on level = person_studylevel.id
group by junior
部分似乎有事情做與concat_group功能,因爲如果我刪除它,它正確地顯示了描述字段。
但名稱字段永遠不會顯示。也許問題是如何處理MySQL函數?
請註明查詢 –