title: RANK, ROW_NUMBER on T-SQL
body: <p>I have rows like this in SQL Server 2014:</p>
  
  <pre><code>id | fld1
  ---+-----
  1  | 100
  2  | 100
  3  | 80
  4  | 102
  5  | 100
  6  | 80
  7  | 102
  </code></pre>
  
  <p>I would need a <em>partition</em> that without changing order would return:</p>
  
  <pre><code>  NewFld | id | fld1
    -------+----+------
     1     | 1  | 100
     1     | 2  | 100
     2     | 3  | 80
     3     | 4  | 102
     1     | 5  | 100
     2     | 6  | 80
     3     | 7  | 102
  </code></pre>
  
  <p><code>Newfld</code> should return the same value based on <code>fld1</code> without changing ordering given by <code>id</code>.</p>
  
  <p>I tried with <code>ROW_NUMBER</code>, <code>RANK</code>, <code>DENSE_RANK</code> but nothing works for me.</p>
  
  <p>View <a href="http://sqlfiddle.com/#!6/5766b/11" rel="nofollow noreferrer">this fiddle</a></p>