SELECT * FROM
(
SELECT events.event_userid, events.event_rideid, events.event_date, events.event_unregisteredname, events.event_unregisteredtype, eventfeedback.*
FROM events INNER JOIN eventfeedback
WHERE (events.id = eventfeedback.event_id AND events.event_rideid = ) AND (events.event_groupid = '' OR events.event_groupid=0) ORDER BY eventfeedback.id DESC
) as sub_feedback
GROUP BY sub_feedback.event_id
ORDER BY sub_feedback.id DESC - 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 ') AND (events.event_groupid = '' OR events.event_groupid=0) ORDER BY eventfeedb' at line 3