22,210
社区成员
发帖
与我相关
我的任务
分享
select
sum(case PrintNum when 0 then 1 else 0 end) as 未打印的数据,
sum(case when PrintNum>0 then 1 else 0 end) as 已打印数据,
count(1) as 全部数据
from
tb
select
未打印的数据=sum(case when PrintNum=0 then 1 else 0 end),
已打印的数据=sum(case when PrintNum>0 then 1 else 0 end),
全部数据=sum(case when PrintNum>=0 then 1 else 0 end)
from tb
select
sum(case when PrintNum=0 then 1 else 0 end) as 未打印的数据,
sum(case when PrintNum>0 then 1 else 0 end) as 已打印数据,
count(1) as 全部数据
from
tb