首页 > 代码库 > MYSQL 按时间 GROUP BY

MYSQL 按时间 GROUP BY

SELECT DATE_FORMAT( startDateTime, "%Y-%m-%d %H" ) AS date, COUNT(*) AS num
FROM data_service
GROUP BY date ORDER BY date;

按照每天每小时统计数量

 

End.