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.friendly_url ORDER BY e.date' at line 15SELECT e.*, e.name_ukr as name, h.name_ukr as hall_name, ct.name_ukr as city_name FROM events e LEFT JOIN events2category e2c ON e2c.event_id = e.id LEFT JOIN category c ON c.id = e2c.category_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.friendly_url ORDER BY e.date