title: Simulate lag function in MySQL
body: <pre><code>| time                | company | quote |
  +---------------------+---------+-------+
  | 0000-00-00 00:00:00 | GOOGLE  |    40 |
  | 2012-07-02 21:28:05 | GOOGLE  |    60 |
  | 2012-07-02 21:28:51 | SAP     |    60 |
  | 2012-07-02 21:29:05 | SAP     |    20 |
  </code></pre>
  
  <p>How do I do a lag on this table in MySQL to print the difference in quotes, for example:</p>
  
  <pre><code>GOOGLE | 20
  SAP    | 40  
  </code></pre>