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 events_evt.id_evt HAVING max(eventsDates_eda.end_eda)>=NOW() ORDER BY m' at line 1