我有一个监控系统,它每 n 秒收集一次数据(n 大约为 10,但会有所不同).我想按 15 分钟的时间间隔汇总收集的数据.有没有办法将时间戳值合并为 15 分钟的块以允许分组工作?
I've got a monitoring system that is collecting data every n seconds (n is approximately 10 but varies). I'd like to aggregate the collected data by 15 minute intervals. Is there a way to consolidate the timestamp values into 15 minute chunks to allow for grouping to work?
SELECT FLOOR(UNIX_TIMESTAMP(timestamp)/(15 * 60)) AS timekey
FROM table
GROUP BY timekey;
这篇关于以 15 分钟为间隔对 mysql 查询进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!