sql每天统计查询

阅读更多
select YEAR(createtime)年,MONTH(createtime)月,DAY(createtime)日,COUNT(*)呼叫量
from AGENTRECFILE
where (ExtensionNumber like '56%' or ExtensionNumber like '57%')
and CreateTime >='2017-09-01' and CreateTime <='2017-09-15'
group by YEAR(CreateTime), MONTH(CreateTime), DAY(CreateTime)

select convert(char(8),CreateTime,112)日期,COUNT(*)呼叫量
from AGENTRECFILE
where (ExtensionNumber like '56%' or ExtensionNumber like '57%')
and CreateTime >='2017-09-01' and CreateTime <='2017-09-15'
group by convert(char(8),CreateTime,112)

你可能感兴趣的:(sql每天统计查询)