我需要确定每个月以 10 分钟的增量接听多少电话。我有以下 SQL 查询可以在半小时内工作,但我无法让它以 10 分钟为增量工作。我可能缺少一些简单的东西。任何帮助将不胜感激。谢谢
select
count(*) as Callcount,
case
when datepart(mi, PBXqtime) < 30
then dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0)
else dateadd(mi, 30, dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0))
end as time
from
callcomplete
where
CustId = '3100472'
and PBXQTime between '11/1/11 0:0:00' and '11/30/11 23:59:00'
group by
case
when datepart(mi, PBXqtime) < 30
then dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0)
else dateadd(mi, 30, dateadd(hh, datediff(hh, 0, PBXqtime) + 0, 0))
end