我要计算总出席人数.以及单个查询中有多少次呼叫成功联系人 [英] I want to count total No of Attend Call. and how much call Successful Contact in a single query

查看:72
本文介绍了我要计算总出席人数.以及单个查询中有多少次呼叫成功联系人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个具有字段的表.--Name,ContactStatus(它可以是呼叫断开,再次联系,参与,成功联系)
我要计算总出席人数.以及在单个查询中呼叫成功联系人的数量

We have a table having field.--Name ,ContactStatus(it may be Call Disconnected, Contact Again, Engaged, Successful Contact)
I want to count total No of Attend Call. and how much call Successful Contact in a single query

推荐答案

此陈述获取所有类型的计数

this statment get count of all and every type

select
 COUNT(*) [total No of Attend Call]
 ,SUM(case when ContactStatus='Successful Contact' then 1 else 0 end)[Successful Contact count]
 ,SUM(case when ContactStatus='Engaged' then 1 else 0 end)[Engaged count]
 ,SUM(case when ContactStatus='Contact Again' then 1 else 0 end)[Contact Again count]
 ,SUM(case when ContactStatus='Disconnected' then 1 else 0 end)[Disconnected count]
 from tableName


这篇关于我要计算总出席人数.以及单个查询中有多少次呼叫成功联系人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆