0
我們能有一個開關罩查詢更Yii2 ActiveQuery方式比低於核心SQL?開關的情況下
$comboGraph = \Yii::$app->db->createCommand('select class , count(*) registered, '.
'sum(case when payment_status = \'1\' then 1 else 0 end) paid, '.
'sum(case when payment_status = \'0\' then 1 else 0 end) unpaid '.
'from students group by class ORDER BY FIELD(class,\'V\',\'VI\',\'VII\')')
->queryAll();
我得到的結果,即使我用上面的查詢,但我想我的東西更Yii2具體。那麼有什麼建議?