日期:2014-05-19  浏览次数:20613 次

50分请教这个合计的SQL语句怎么写啊????
表中有2个标识字段FIsRead,FIsNotify都是   bit型的

FIsRead   FIsFeedback
-------   -----------
1               1
0               0
1               1
1               0
0               1
1               0
现在要一起统计FIsRead   为1和FIsFeedback为1的行数
在一个结果集中
FIsRead   FIsFeedback
-------   -----------
4               3

这个语句怎么写啊?

------解决方案--------------------
select
sum(case FIsRead when 1 then 1 else 0 end) as FIsRead,
sum(case FIsFeedback when 1 then 1 else 0 end) as FIsFeedback
from table