3,487
社区成员




select sum(case when sal<2000 then 1 else 0 end) xy2000,
sum(case when sal>=2000 and sal<=4000 then 1 else 0 end) y2000_4000,
sum(case when sal>4000 then 1 else 0 end) dy4000
from yourTable;
select count(case when sal<2000 then 1 else null end) xy2000,
count(case when sal>=2000 and sal<4000 then 1 else null end) y2000_4000,
count(case when sal>4000 then 1 else null end) dy4000
from yourTable;