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