title: Subtract first two rows only for each value
body: <p>I have a specific query to run which should subtract two rows from each other. It shouldn't subtract the entire row but only the fields specified. The data I'm trying to subtract is organized like so:</p>
  
  <pre><code>object # |       timestamp     | input_rate1 | output_rate1 | ...
  
     obj1  | 2011-07-20 05:53:33 |    349393   |    25843     | ...
  
     obj1  | 2011-07-20 05:23:20 |    222293   |    11019     | ...
  </code></pre>
  
  <p>The result would then be <code>00:30:13 |  127100 | 48824  .</code> </p>
  
  <p>I found a post that showed how to do this but the difference between their data and mine is that mine does not have an id field that can keep track what line I'm at. I tried using the row_number() but my sql server doesn't support it. </p>
  
  <p>Is this even possible without using the id field? I forgot to mention that each object has more than two timestamp records, but I really only need to do it for the two latest.</p>