Using MySQL variables in a query
- by Jon Tackabury
I am trying to use this MySQL query:
SET @a:=0; UPDATE tbl SET sortId=@a:=@a+1 ORDER BY sortId;
Unfortunately I get this error:
"Parameter '@a' must be defined"
Is it possible to batch commands into 1 query like this, or do I need to create a stored procedure for this?