22,209
社区成员
发帖
与我相关
我的任务
分享
--参考一下
create table e
(
diff nvarchar(10)
)
insert into e
select '1' union all
select '1' union all
select '1' union all
select '1' union all
select '0' union all
select '0' union all
select '0' union all
select '-1' union all
select '-1' union all
select '-1'
go
select
count(case when diff = '1' then 1 end) dat1,
count(case when diff = '0' then 1 end) dat2,
count(case when diff = '-1' then 1 end) dat3
from e