title: Using MySQL variables in a query
body: <p>I am trying to use this MySQL query:  </p>
  
  <pre><code>SET @a:=0; UPDATE tbl SET sortId=@a:=@a+1 ORDER BY sortId;
  </code></pre>
  
  <p>Unfortunately I get this error:<br>
  "Parameter '@a' must be defined"</p>
  
  <p>Is it possible to batch commands into 1 query like this, or do I need to create a stored procedure for this?</p>