2011-03-27 13:41:30 0 评论 Yii 1.0 Boy.Lee

Yii 1.0 DAO 使用 group by 和 group_concat

{Coding}

$data_type_maps = Yii::app()->db->createCommand()
                    ->select('group_concat(`map_name` ORDER BY num_download_all DESC separator \'-\') AS mix_map_name,
                    				  group_concat(`map_img`  ORDER BY num_download_all DESC separator \'-\') AS mix_map_img,
                    				  group_concat(`id` ORDER BY num_download_all DESC separator \'-\') AS mix_map_id,
                    				  map_type_id')
                    ->from('sc2m_map')
                    ->where('status_type_id='.Yii::app()->params['valuePass'])
                    ->group('map_type_id')
                    ->queryAll();

 

{Point}

group_concat(`map_name` ORDER BY num_download_all DESC separator \'-\')