Skip to content
Advertisement

Wrong syntax for OVER and PARTITION in MySQL syntax

I get the error “Syntax error: Unexpected ‘(‘ (opening parenthesis)

Does MySQL not support this? I’m pretty sure I’ve done this before and from what I see on google this should work.

Advertisement

Answer

Window functions are available in MySQL 8.0 only.

In earlier versions, you can use a subquery – however, your code is missing an ORDER BY clause, which makes the sort inconsistant. Assuming that you want to sort orders of the same customer by their id, you would phrase this as:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement