CTE syntax error

I'm a new user of Metabase, not an admin. trying to do common table expression to group by working hours not calendar. but it keeps showing the following error message no idea why. would appreciate some help. here is an example.

Hi @fatma
MySQL is sadly really terrible at reporting the specific error.
But it looks like you highlighted parts of the query and then ran only that.

same error whole query or only CTE part. don't know what's wrong. I have validated the query on syntax check and looks fine. it's really frustrating. followed Metabase documentation for CTE still the same error.

@fatma Try running the query in any other tool - example DBeaver.io
The SQL is just sent to your MySQL, so the problem is somewhere there - not with Metabase.

correct. I found out Mysql version used is 5.7 not 8. CTE only supported by version 8.
do you know a way to group by working hours not calendar on metabse

@fatma I'm not sure what you're looking for, but group by hour(`your_column`) might be what you're looking for. Otherwise I would recommend that you search on stackoverflow.com