title: SQL Server Reverse Running Total
body: <p>I have this table:</p>
  
  <pre><code>id  ID  Date    Cumulative
  1   x   Jan-10  10
  3   x   Feb-10  40
  7   x   Apr-10  60
  9   x   May-10  100
  2   y   Jan-10  20
  6   y   Mar-10  40
  8   y   Apr-10  60
  10  y   May-10  100
  </code></pre>
  
  <p>I need to Reverse the "Cumulative" in MS SQL Server Query to be as the following</p>
  
  <pre><code>id  ID  Date    Cumulative  Reversed
  1   x   Jan-10  10  10
  3   x   Feb-10  40  30
  7   x   Apr-10  60  20
  9   x   May-10  100 40
  2   y   Jan-10  20  20
  6   y   Mar-10  40  20
  8   y   Apr-10  60  20
  10  y   May-10  100 40
  </code></pre>
  
  <p>Note: query is for SQL Server 2012</p>