标签:
select AckBegin , count(*) as incallcount,CallType, convert(varchar(10),sum(datediff(s,callbegin,callend))/3600)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600/60)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600%60) as Calltime
from TB_CallRecord where AckBegin between ‘2015-6-1‘ and ‘2015-6-5‘ group by CallType,AckBegin
select AckBegin,COUNT(*) as incallcount, YEAR(WaitBegin) as nian,calltype,convert(varchar(10),sum(datediff(s,callbegin,callend))/3600)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600/60)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600%60) as Calltime
from TB_CallRecord where AckBegin between ‘2015-6-1‘ and ‘2015-6-5‘ group by CallType,WaitBegin,AckBegin
select COUNT(*) as incallcount,calltype, cast(year(cast (WaitBegin as datetime)) as varchar(4))+‘-‘+ cast( month(cast (WaitBegin as datetime)) as varchar(2)) as yue, convert(varchar(10),sum(datediff(s,callbegin,callend))/3600)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600/60)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600%60) as Calltime
from TB_CallRecord group by CallType,WaitBegin order by CallType
select count(*) as incallcount,calltype,cast(year(cast (WaitBegin as datetime)) as varchar(4))+‘-‘+ cast( month(cast (WaitBegin as datetime)) as varchar(2))+‘-‘+cast(day(cast (WaitBegin as datetime)) as varchar(2)) as ri, convert(varchar(10),sum(datediff(s,callbegin,callend))/3600)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600/60)+‘:‘+convert(varchar(10),sum(datediff(s,callbegin,callend))%3600%60) as Calltime
from TB_CallRecord group by CallType,WaitBegin order by CallType
标签:
原文地址:http://www.cnblogs.com/zhaojingwei/p/4554838.html