Created
January 17, 2014 16:53
-
-
Save t11a/8476889 to your computer and use it in GitHub Desktop.
5分おきの頻度を出力するクエリ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select FROM_UNIXTIME(TRUNCATE(UNIX_TIMESTAMP(addtime(created_at,'09:00:00'))/300,0)*300) as _time, count(*) | |
from sales | |
where | |
created_at between '2014-01-17 15:00:00' and '2014-01-18 14:59:59' | |
GROUP BY _time; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
addtime(created_at,'09:00:00')してるのはTimezoneが9時間ズレてる場合のときなので、不要であればはずす。