$sql = "SELECT count(*) as totalNum from beauty_photos as p left join beauty_user as u on p.uid=u.id where p.status=1 and p.is_delete=0 and u.is_delete=0 group by p.uid"; $count = \Yii::$app->db4->createCommand($sql)->queryAll();
原文:https://www.cnblogs.com/bneglect/p/12148413.html