title: Deleting repeating values in database
body: <p>I have a MySql table which is populating daily with price values. Each day it records an entry even if the price hasn't changed. I want to delete some rows that repeat too much. I want to keep the first price and the last price before there is a price change.</p>
  
  <p><strong>Example 1)</strong></p>
  
  <pre><code>   id name     price date
      1 Product1 $6 13/07/2017
      2 Product1 $6 14/07/2017
      3 Product1 $6 15/07/2017
      4 Product1 $7 16/07/2017
      5 Product1 $6 17/07/2017
      6 Product1 $6 18/07/2017
      7 Product1 $6 19/07/2017
  </code></pre>
  
  <p>From that list records with id 2 and 6 should be deleted with the following result:</p>
  
  <pre><code>   id name     price date
      1 Product1 $6 13/07/2017
      3 Product1 $6 15/07/2017
      4 Product1 $7 16/07/2017
      5 Product1 $6 17/07/2017
      7 Product1 $6 19/07/2017
  </code></pre>
  
  <p><strong>Example 2)</strong></p>
  
  <pre><code>   id name     price date
      1 Product1 $6 13/07/2017
      2 Product1 $6 14/07/2017
      3 Product1 $6 15/07/2017
      4 Product1 $6 16/07/2017
      5 Product1 $6 17/07/2017
      6 Product1 $6 18/07/2017
      7 Product1 $6 19/07/2017
  </code></pre>
  
  <p>Here there is no price change so I can delete all records from 2 to 6:</p>
  
  <pre><code>   id name     price date
      1 Product1 $6 13/07/2017
      7 Product1 $6 19/07/2017
  </code></pre>
  
  <p>Id is not supposed to be one incremental and also date is not updated on daily basis. </p>