我在query的sql中加入下面语句,编译时有问题,应该如何用:
select *,case
      when 高级工程师 then 工程技术人员
      when 工程师 then 工程技术人员
      when 高级工 then 工人
      when 中级工 then 工人
    end, as aa(新字段名) 
from table3 

解决方案 »

  1.   

    我也是sql 新手,试试下面的吧,我是在sql server 7.0下。tablename: csdn   zc         rs
      高工师      10
      工师        20
      高工        50
      工          100
    select case zc
       when '高工' then '工'
       when '工人' then '工'
       when '高工师' then '技术'
       when '工师' then '技术'
       end as xzc,
       sum (rs) zrs
    from csdn
    group by case zc
       when '高工' then '工'
       when '工人' then '工'
       when '高工师' then '技术'
       when '工师' then '技术'
       end