SELECT `s`.*, (SELECT COUNT(*) FROM `db_teachers_subjects` AS `ts` LEFT JOIN `db_teachers` AS `t` ON `t`.`id` = `ts`.`idTeacher` AND `t`.`published` = 1 WHERE `ts`.`idSubject` = `s`.`id` AND `t`.`idCity` = ) AS `countTeacher` FROM `db_subjects` AS `s`
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS `countTeacher` FROM `db_subjects` AS `s`' at line 1