title: How to print sequential number for records in SQL Server
body: <p>I have a table with only one column (class) having records</p>
  
  <pre><code>a
  a
  a
  a
  b
  b
  b
  b
  </code></pre>
  
  <p>I want to run a query so that the output will look like below.</p>
  
  <pre><code>Class | RowNumber
  -----------------
  a     |    1
  a     |    2
  a     |    3
  a     |    4
  b     |    1
  b     |    2
  b     |    3
  b     |    4 
  </code></pre>