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 'GROUP BY e.name_rus ORDER BY min_date' at line 23SELECT e.*, e.name_ukr as name, h.name_ukr as hall_name, ct.name_ukr as city_name, COUNT(DISTINCT as events_count, MIN( as min_date, MAX( as max_date, GROUP_CONCAT(DISTINCT g.name_ukr SEPARATOR ', ') as genre_name FROM events e LEFT JOIN events2category_new e2c ON e2c.event_id = LEFT JOIN category_new c ON = e2c.category_id LEFT JOIN events2genre e2g ON e2g.event_id = LEFT JOIN genre g ON = e2g.genre_id LEFT JOIN halls h ON = e.hall_id LEFT JOIN city ct ON = h.city_id WHERE h.status = 1 AND e.status = 1 AND ct.friendly_url = 'kiev' AND ( >= UNIX_TIMESTAMP() OR e.date_to >= UNIX_TIMESTAMP()) AND = GROUP BY e.name_rus ORDER BY min_date