SELECT COUNT(DISTINCT(a.id)) as total FROM event a  LEFT JOIN event_date c on (c.event_id = a.id)  WHERE 1 AND DATE_FORMAT(c.date,'%Y-%m-%d')= DATE_FORMAT ('2023-03-22 11:22:22','%Y-%m-%d') AND a.online=1 AND a.date_online <= '2023-03-22 11:22:22'
FUNCTION lacid_www.DATE_FORMAT does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual