I have this query which works without problems in Mysql 5.* but I recently upgraded to MySQL 8 and now the query throws a syntax error as follows:
You have an error i