Skip to content
Advertisement

Trying to update a table in mysql 8.0 using ROW_NUMBER fails within the subquery

I am trying to update a table in my database using ROW_NUMBER in mysql.

Table stats:

I tried using the ROW_NUMBER alone as:

and got the following result:

Then, I tried to update the value_rank using this statement:

However, I got the following error:

Error in query (1064): Syntax error near ‘(SELECT id, value, ROW_NUMBER() OVER w AS rank FROM stats WINDOW w AS (O’ at line 2

I used this query after following this documentation (last paragraph)

What am I doing wrong?

Advertisement

Answer

You need JOIN:

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