RsD0p9BK
1/13/2016 - 6:23 AM

group_by_time.sql

-- Group By half an hour

SELECT * FROM bk_2016_01_12 a
WHERE 2 = 2
GROUP BY EXTRACT(HOUR FROM a.dtime), FLOOR(MINUTE(a.dtime)/30);

-- http://www.sitepoint.com/forums/showthread.php?430461-Group-By-half-an-hour
-- http://stackoverflow.com/questions/22283244/group-by-half-hour-interval
-- http://stackoverflow.com/questions/10066354/how-to-count-number-of-messages-per-half-hour