title: Is there a way to access the "previous row" value in a SELECT statement?
body: <p>I need to calculate the difference of a column between two lines of a table. Is there any way I can do this directly in SQL? I'm using Microsoft SQL Server 2008.</p>
  
  <p>I'm looking for something like this:</p>
  
  <pre><code>SELECT value - (previous.value) FROM table
  </code></pre>
  
  <p>Imagining that the "previous" variable reference the latest selected row. Of course with a select like that I will end up with n-1 rows selected in a table with n rows, that's not a probably, actually is exactly what I need.</p>
  
  <p>Is that possible in some way?</p>