title: Update SQL with consecutive numbering within a group
body: <p>I found the technique to update rows of a table with consecutive numbers here:</p>
  
  <p><a href="https://stackoverflow.com/questions/1167885/update-sql-with-consecutive-numbering">Update SQL with consecutive numbering</a></p>
  
  <p>The gist of the technique is to use (T-SQL):</p>
  
  <pre><code>update myTable
  SET @myvar = myField = @myVar + 1
  </code></pre>
  
  <p>which is awesome and works very well.</p>
  
  <p>Can this technique be extended to number different groups of records, with each group starting with 1 ? e.g. </p>
  
  <ul>
  <li>Category 1 rows should get a sequence number 1,2,3,....</li>
  <li>Category 2 rows should also get a sequence number 1,2,3,.....</li>
  </ul>