Reputation: 3
I have tried this query:
SELECT @rownumber:=@rownumber+1 as rownumber, column From Table, (SELECT @rownumber:=0) D
in my workbench and it works but it does work in spring data jpa. I get this error instead:
Caused by: org.hibernate.QueryException: Not all named parameters have been set: [0, @rownumber]
I have tried switching the postion of the colon like this @rownumber=:@rownumber+1
and @rownumber=:0
What could be the problem with the query? Is there a way to correct it or is there proven way to include serial number in my query result?
Upvotes: 0
Views: 1249
Reputation: 57421
Try to escape the :
char and use \\:
SELECT @rownumber\\:=@rownumber+1 as rownumber, column
From Table, (SELECT @rownumber\\:=0) D
Upvotes: 1