作业帮 > 综合 > 作业

sql case when then ...虚心求教

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/23 19:44:33
sql case when then ...虚心求教
select
case salary
when 5000 then '高薪'
when 4500 then '中薪'
when 3500 then '中低薪'
else 'null'
end as '工资等级'
from telenolist
我想统计各个工资级别的人数 那个count(*)应该放在语句的哪里,还用再填写别的语句吗?.
sql case when then ...虚心求教
select
count(*) as cnt,
case salary
when 5000 then '高薪'
when 4500 then '中薪'
when 3500 then '中低薪'
else 'null'
end as '工资等级'

from telenolist
group by case salary
when 5000 then '高薪'
when 4500 then '中薪'
when 3500 then '中低薪'
else 'null'
end