title: How can I use Row Num partition by different default value
body: <p>I have something like</p>
  <pre><code>ID Mobile isOptOut 
  1  123     1
  2  123     0
  3  123     0
  4  123     1
  5  234     1
  6  234     0
  </code></pre>
  <p>to have something like partition by mobile and isOptOut
  if the isOptOut is equal to 1 start from 0
  otherwise start from 6</p>
  <pre><code>ID Mobile isOptOut RowNum
  1  123    1        0 
  4  123    1        1
  2  123    0        6
  3  123    0        7
  5  234    1        0
  6  234    0        6
  
  select *,
  case when isOptOut = 0 then ROW_Number() OVER(
      PARTITION BY Mobile ,isOptOut
      order by Mobile ,isOptOut
  ) as [Row Number]
  from r
  where isOptOut = 1
  </code></pre>
  <p>Thanks so much</p>