Вот так пишу
Watch::find()->select(['fl_serial.*,COUNT(*) AS total_count']) ->leftJoin(['fl_serial','`fl_serial`.`id`=`fl_watch`.`id_serial`'])
->where(['fl_watch.active'=>1])->groupBy('fl_watch.id_serial')->orderBy(['total_count'=>SORT_DESC])->limit(10)->all();
получаю
Syntax error or access violation: 1064 You have an error in your SQL syntaxYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `fl_watch`.`active`=1 GROUP BY `fl_watch`.`id_serial` ORDER BY `total_coun' at line 1
The SQL being executed was: SELECT fl_serial.*,COUNT(*) AS total_count FROM `fl_watch` LEFT JOIN `fl_serial` WHERE `fl_watch`.`active`=1 GROUP BY `fl_watch`.`id_serial` ORDER BY `total_count` DESC LIMIT 10
не понимаю почему не отрабатывается полностью ->leftJoin(['fl_serial','fl_serial.id=fl_watch.id_serial']) подскажите где я ошибся.