title: How to reset DENSE_RANK
body: <p>I have the following table</p>
  <blockquote>
  <p>Id,Cat1,Cat2,ColA,ColB,</p>
  <p>1,1,1,,</p>
  <p>2,1,1,,</p>
  <p>3,1,2,,</p>
  <p>4,1,3,,</p>
  <p>5,2,11,,</p>
  <p>6,2,12,,</p>
  <p>7,2,12,,</p>
  </blockquote>
  <p>I need to add a unique sequential number per grouping column of Cat2 starting at 1 BUT it has to reset back to 1 when Cat1 changes</p>
  <p>My output should be</p>
  <blockquote>
  <p>Row, Id,Cat1,Cat2,ColA,ColB,</p>
  <p>1,1,1,1,,</p>
  <p>1,2,1,1,,</p>
  <p>2,3,1,2,,</p>
  <p>3,4,1,3,,</p>
  <p>1,5,2,11,,</p>
  <p>2,6,2,12,,</p>
  <p>2,7,2,12,,</p>
  </blockquote>
  <p>DENSE_RANK() works to give a unique value e.g.</p>
  <pre><code>Row= DENSE_RANK() OVER ( ORDER BY Cat2)
  </code></pre>
  <p>but I need it to reset itself based of another column Cat1</p>