title: Pure-SQL Technique for Auto-Numbering Rows in Result Set
body: <p>I'm looking for a way to sequentially number rows in a <em>result set</em> (not a table).  In essence, I'm starting with a query like the following:</p>
  
  <pre><code>SELECT id, name FROM people WHERE name = 'Spiewak'
  </code></pre>
  
  <p>The <code>id</code>s are obviously not a true sequence (e.g. <code>1, 2, 3, 4</code>).  What I need is another column in the result set which contains these auto-numberings.  I'm willing to use a SQL function if I have to, but I would rather do it without using extensions on the ANSI spec.</p>
  
  <p>Platform is MySQL, but the technique should be cross-platform if at all possible (hence the desire to avoid non-standard extensions).</p>