title: MySql sum records daily from 2:00 am instead of midnight.
body: <p>For a business closing at 2:00 am, daily accounting ends then. How do I write or simplify this query to sum daily traffic where the top of the clock is actually at 2:00.</p>
  
  <pre><code>    SELECT date( CAST( Time - INTERVAL 2 HOUR AS DATETIME ) ) AS date, 
  CAST( (sum( `in_count` ) + sum( `out_count` ) ) /2 AS UNSIGNED) AS count
  FROM establishment
  LEFT JOIN `device` ON establishment.establishment_ID = device.establishment_ID
  LEFT JOIN `device_state` ON device.device_id = device_state.device_ID
  WHERE establishment.establishment_ID =1
  AND date(CAST( Time - INTERVAL 2 HOUR AS DATETIME ))
  BETWEEN '2013-02-01' AND '2013-03-01'
  GROUP BY dayofmonth( CAST( Time - INTERVAL 2 HOUR AS DATETIME ))
  ORDER BY Time
  </code></pre>