title: How to get count by day in My SQL
body: <p>This table contains count of orders by hour in time stamp:</p>
  
  <p>orders</p>
  
  <pre><code>id, created_at, items
  1, 1484827200, 5
  2, 1484830800, 10
  3, 1484913600, 10
  </code></pre>
  
  <p>// how to get count of items by day?
  something like that:</p>
  
  <pre><code>2016-01-19, 15
  2016-01-20, 10
  </code></pre>
  
  <p>my query:</p>
  
  <pre><code>SELECT sum(items)
  FROM orders
  GROUP BY EXTRACT(DAY_HOUR FROM created_at)
  </code></pre>
  
  <p>is not correct.</p>
  
  <pre><code>SELECT day(from_unixtime(created_at)), sum(items)
  FROM orders
  GROUP BY day (from_unixtime(created_at))
  </code></pre>
  
  <p>too slow.</p>