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 e.id) as events_count, MIN(e.date) as min_date, MAX(e.date) 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 = e.id LEFT JOIN category_new c ON c.id = e2c.category_id LEFT JOIN events2genre e2g ON e2g.event_id = e.id LEFT JOIN genre g ON g.id = e2g.genre_id LEFT JOIN halls h ON h.id = e.hall_id LEFT JOIN city ct ON ct.id = h.city_id WHERE h.status = 1 AND e.status = 1 AND ct.friendly_url = 'kiev' AND (e.date >= UNIX_TIMESTAMP() OR e.date_to >= UNIX_TIMESTAMP()) AND c.id = GROUP BY e.name_rus ORDER BY min_date