title: Calculating value using previous value of a row in T-SQL
body: <p>I got following table and want to calculate value of Column2 on each row using the value of the same column (Column2) from the previous row in a sql without using cursor or while loop.</p>
  
  <pre><code>Id   Date             Column1    Column2
  1    01/01/2011       5          5 =&gt; Same as Column1
  2    02/01/2011       2          18 =&gt; (1 + (value of Column2 from the previous row)) * (1 + (Value of Column1 from the current row)) i.e. (1+5)*(1+2)
  3    03/01/2011       3          76 =&gt; (1+18)*(1+3) = 19*4
  and so on
  </code></pre>
  
  <p>Any thoughts?</p>
  
  <hr>