title: SQL how to subtract result row 1 from row 2, row 2 from row 3
body: <p>How do I subtract row 1 from row 2 and row 2 from row 3, etc. in MySQL?
  The table i am pulling my data from contains multiple products and all products have multiple prices (on different dates)</p>
  
  <p>The code i am working with:</p>
  
  <pre><code> SELECT 
          orderline_sales.product_name,
          orderline_sales.price
      FROM
          orderline_sales         
      GROUP BY price
      HAVING orderline_sales.product_name = 'Ibuprofen';
  </code></pre>
  
  <p>The result I am getting:</p>
  
  <pre><code>|---------------------|------------------|
  |      product_name   |     price        |
  |---------------------|------------------|
  |       Ibuprofen     |      30.20       |
  |---------------------|------------------|
  |       Ibuprofen     |      32.20       |
  |---------------------|------------------|
  |       Ibuprofen     |      35.20       |
  |---------------------|------------------|
  </code></pre>
  
  <p>The result I want:</p>
  
  <pre><code>|---------------------|------------------|------------------|
  |      product_name   |     price        |   price_change   |
  |---------------------|------------------|------------------|
  |       Ibuprofen     |      30.20       |         0        |
  |---------------------|------------------|------------------|
  |       Ibuprofen     |      32.20       |         2        |
  |---------------------|------------------|------------------|
  |       Ibuprofen     |      35.20       |         3        |
  |---------------------|------------------|------------------|
  </code></pre>