27,579
社区成员
发帖
与我相关
我的任务
分享
select F1,F2,F3 from
(select
isnull(sum(case when cAlarmtype='火警' then 1 else 0 end),0) as F1,
isnull(sum(case when cAlarmtype='故障' then 1 else 0 end),0) as F2,
isnull(sum(case when cAlarmtype='管理信息' then 1 else 0 end),0) as F3
from tab) t
where not (F1=0 and F2=0 and F3=0)
SELECT isnull(sum(case when cAlarmtype='火警' then 1 else 0 end),0) as F1,
isnull(sum(case when cAlarmtype='故障' then 1 else 0 end),0) as F2,
isnull(sum(case when cAlarmtype='管理信息' then 1 else 0 end),0) as F3
from tab
where cAlarmtype='火警' or cAlarmtype='故障' or cAlarmtype='管理信息'