title: MySQL: Auto increment temporary column in select statement
body: <p>How do I create and auto increment a temporary column in my select statement with MySQL?</p>
  
  <p>Here is what I have so far: </p>
  
  <pre><code>SET @cnt = 0;
  SELECT
      (@cnt =@cnt + 1) AS rowNumber,
      rowID
  FROM myTable
  WHERE CategoryID = 1
  </code></pre>
  
  <p>Which returns: </p>
  
  <pre><code>+++++++++++++++++++++
  + rowNumber | rowID +
  +++++++++++++++++++++
  +  (NULL)   |   1   +
  +  (NULL)   |   25  +
  +  (NULL)   |   33  +
  +  (NULL)   |   150 +
  +  (NULL)   |   219 +
  +++++++++++++++++++++
  </code></pre>
  
  <p>But I need:</p>
  
  <pre><code>+++++++++++++++++++++
  + rowNumber | rowID +
  +++++++++++++++++++++
  +  1        |   1   +
  +  2        |   25  +
  +  3        |   33  +
  +  4        |   150 +
  +  ...      |   ... +
  +++++++++++++++++++++
  </code></pre>