LoginSignup
14
18

More than 5 years have passed since last update.

MySQLで5分毎、10分毎の集計

Posted at

5分ごと

select from_unixtime(round(unix_timestamp(created_at) div (5 * 60)) * (5 * 60)) as timekey from waitings group by timekey;

10分ごと

select from_unixtime(round(unix_timestamp(created_at) div (10 * 60)) * (10 * 60)) as timekey from table group by timekey;
14
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
18