按月统计
方案1:
SELECT DATE_FORMAT(START_TIME_, '%Y-%m') AS month,
COUNT(*) AS count
FROM ACT_HI_PROCINST
WHERE START_TIME_ >= '2024-06-27' AND START_TIME_ < '2024-08-08' -- 替换为你的日期范围
GROUP BY DATE_FORMAT(START_TIME_, '%Y-%m')
ORDER BY month;
方案2:
SELECT YEAR(START_TIME_) AS year,
MONTH(START_TIME_) AS month,
COUNT(*) AS count
FROM ACT_HI_PROCINST
GROUP BY YEAR(START_TIME_), MONTH(START_TIME_)
ORDER BY year, month;
按天统计
SELECT DATE(START_TIME_) AS date,
COUNT(*) AS count
FROM ACT_HI_PROCINST
WHERE START_TIME_ >= '2024-06-27' AND START_TIME_ < '2024-08-08' -- 替换为你的日期范围
GROUP BY DATE(START_TIME_)
ORDER BY DATE(START_TIME_);
标签:08,SQL,month,2024,START,TIME,DATE,数据,统计
From: https://www.cnblogs.com/byteexpress/p/18324292