title: difference between the first value and the last values of the each days
body: <p>In a table, I have several measures per day</p>
  
  <pre><code>29011   2012-12-28 09:00:00
  28701   2012-12-28 10:00:00
  28830   2012-12-28 11:00:00
  28353   2012-12-28 12:00:00
  28642   2012-12-28 13:00:00
  28583   2012-12-28 14:00:00
  28800   2012-12-29 09:00:00
  28751   2012-12-29 10:00:00
  28670   2012-12-29 11:00:00
  28621   2012-12-29 12:00:00
  28599   2012-12-29 13:00:00
  28278   2012-12-29 14:00:00
  </code></pre>
  
  <p>How can I obtain the <strong>difference</strong> between <strong>the first last values of the each days</strong> ?</p>
  
  <p>I would like a result like this :</p>
  
  <pre><code>428 2012-12-28
  522 2012-12-29
  </code></pre>
  
  <p>I have tried this</p>
  
  <pre><code>SELECT (MAX(volume) - MIN(volume)),DATE_FORMAT(FROM_UNIXTIME(tstamp), '%Y-%m-%d') date FROM tank
  GROUP BY DATE_FORMAT(FROM_UNIXTIME(tstamp), '%Y-%m-%d')
  ORDER BY tstamp
  </code></pre>
  
  <p>But it doesn't take the first and last measures, but the min and max.</p>