34,838
社区成员




select sum(case when typeID=1 then 1 else 0 end) as one
,sum(case when typeID=2 then 1 else 0 end) as two
,sum(case when typeID=3 then 1 else 0 end) as three
,sum(case when typeID=4 then 1 else 0 end) as four
,sum(case when typeID=5 then 1 else 0 end) as five
from @table
select ne = count(case when typeid=1 then 4134 else null end),
tw = count(case when typeid=2 then 4134 else null end),
tr = count(case when typeid=3 then 1 else null end),
fo = count(case when typeid=4 then 35 else null end),
fv = count(case when typeid=5 then 15 else null end)
from @table
select ne = sum(case when typeid=1 then 1 else 0 end),
tw = sum(case when typeid=2 then 1 else 0 end),
tr = sum(case when typeid=3 then 1 else 0 end),
fo = sum(case when typeid=4 then 1 else 0 end),
fv = sum(case when typeid=5 then 1 else 0 end)
from @table