title: PostgreSQL calculate difference between rows
body: <p>I tried to calculate difference between rows in a field using a query:</p>
  
  <pre>
  Illustrations:
  input:year,month,fixes
  output:increase
  
       year | month | fixes    | increase
      ------+-------+----------+-----------
       2006 | 04    |       1  | 0
       2006 | 05    |       4  | 3
       2006 | 06    |       3  | -1
  </pre>
  
  <p>Increase column as output by difference between adjacent rows in fixes.</p>