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' 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 = LEFT JOIN category c ON = e2c.category_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.friendly_url ORDER BY