title: Comparing record to previous record in postgresql
body: <p>I have a table in PostgreSQL DB like this:</p>
  
  <pre><code> Client | Rate | StartDate|EndDate     
   A      | 1000 | 2005-1-1 |2005-12-31
   A      | 2000 | 2006-1-1 |2006-12-31
   A      | 3000 | 2007-1-1 |2007-12-31  
   B      | 5000 | 2006-1-1 |2006-12-31  
   B      | 8000 | 2008-1-1 |2008-12-31  
   C      | 2000 | 2006-1-1 |2006-12-31  
  </code></pre>
  
  <p>How to get this result?</p>
  
  <pre><code> Client | Rate | StartDate|EndDate    |Pre Rate | Pre StartDate |Pre EndDate    
   A      | 1000 | 2005-1-1 |2005-12-31 |         |               |             
   A      | 2000 | 2006-1-1 |2006-12-31 | 1000    | 2005-1-1      |2005-12-31            
   A      | 3000 | 2007-1-1 |2007-12-31 | 2000    | 2006-1-1      |2006-12-31  
   B      | 5000 | 2006-1-1 |2006-12-31 |         |               |              
   B      | 8000 | 2008-1-1 |2008-12-31 | 5000    | 2006-1-1      |2006-12-31   
   C      | 2000 | 2006-1-1 |2006-12-31 
  </code></pre>
  
  <p>Thanks a lot!!!</p>