title: How do I write a query that outputs the row number as a column?
body: <p>How do I write a query that outputs the row number as a column? This is DB2 SQL on an iSeries.</p>
  
  <p>eg if I have</p>
  
  <p>table Beatles:</p>
  
  <pre><code>John
  Paul
  George
  Ringo
  </code></pre>
  
  <p>and I want to write a statement, without writing a procedure or view if possible, that gives me</p>
  
  <pre><code>1 John
  2 Paul
  3 George
  4 Ringo
  </code></pre>