当前位置: 代码迷 >> 报表 >> 查询通话时间表格
  详细解决方案

查询通话时间表格

热度:278   发布时间:2016-04-29 01:56:53.0
查询通话时间报表

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

  相关解决方案