SELECT concat( date_format( time, '%Y-%m-%d %H:' ) , floor( date_format( time, '%i' ) /10 ) ) AS c, count(1)
FROM table
WHERE time between "2019-07-08 00:00:00" and "2019-07-09 00:00:00"
GROUP BY c
order by c
意思为:每十分钟计算一次count值
SELECT concat( date_format( time, '%Y-%m-%d %H:' ) , floor( date_format( time, '%i' ) /10 ) ) AS c, count(1)
FROM table
WHERE time between "2019-07-08 00:00:00" and "2019-07-09 00:00:00"
GROUP BY c
order by c
意思为:每十分钟计算一次count值