I need to determine how many calls we take in 10 min increaments for the month. I have the following SQL query that works on the half hour but I can not get it to work on 10 minute increments. I am probably missing something simple.. Any help would be appreciated. Thanks
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