mysql按30分钟进行分组
时间:2021-07-01 10:21:17
帮助过:3人阅读
time30,
COUNT(
*)
AS num
FROM
(
select DATE_FORMAT(time,
‘%Y-%m-%d %H:%i‘)
as time30
from(
SELECT DATE_FORMAT(concat(date(CALL_DATE),
‘ ‘,HOUR (CALL_DATE),
‘:‘,
floor(MINUTE(CALL_DATE)
/30)
*30),
‘%Y-%m-%d %H:%i‘ )
AS time
FROM call_detail_records
) a
) as b
GROUP BY time30;
mysql按30分钟进行分组
标签:date count _for cat mys nbsp form tail record