码迷,mamicode.com
首页 > 其他好文 > 详细

查询通话时间报表

时间:2015-06-05 17:15:04      阅读:124      评论:0      收藏: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
技术分享

查询通话时间报表

标签:

原文地址:http://www.cnblogs.com/zhaojingwei/p/4554838.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!