Skip to content

Instantly share code, notes, and snippets.

@t11a
Created January 17, 2014 16:53
Show Gist options
  • Save t11a/8476889 to your computer and use it in GitHub Desktop.
Save t11a/8476889 to your computer and use it in GitHub Desktop.
5分おきの頻度を出力するクエリ。
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;
@t11a
Copy link
Author

t11a commented Jan 17, 2014

出典はこちらです。
http://pk-brothers.com/620/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment