22,298
社区成员
发帖
与我相关
我的任务
分享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
tbselect
未打印的数据=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 tbselect
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