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?
Try to escape the :
char and use \\\\:
SELECT @rownumber\\:=@rownumber+1 as rownumber, column
From Table, (SELECT @rownumber\\:=0) D
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.