select zsb.*,
       case
         when zsb.type = '市管领导干部' then 'A'
         when zsb.type = '局级后备干部' then 'B'
         when zsb.type = '区县、大口、市直单位干教干部' then 'C'
         when zsb.type = '委管组织部前备案干部' then 'A'
         when zsb.type = '委管组织部后备案干部' then 'B'
         when zsb.type = '国资委机关局级后备干部' then 'B'
         when zsb.type = '市管国企领导人员副职后备人选' then 'B'
         when zsb.type = '处级干部' then 'D'
         when zsb.type = '企业参照正局、副局' then 'A'
         when zsb.type = '其他' then 'B'
         when zsb.type = '—' then 'D'
       end as typeEn
  from zzxk_studentBatch zsb为什么我执行这些语句 然后 zxb.type显示的还是原来的中文 不是应该 比如  when zsb.type = '市管领导干部' then 'A'应该 type变成a了吗

解决方案 »

  1.   

    Of cause the "type" is still Chinese, and the last column "typeEn" should be something like 'A','B'...
      

  2.   


    select zsb.*,
      case
      when trim(zsb.type) = '市管领导干部' then 'A'
      when trim(zsb.type) = '局级后备干部' then 'B'
      when trim(zsb.type) = '区县、大口、市直单位干教干部' then 'C'
      when trim(zsb.type) = '委管组织部前备案干部' then 'A'
      when trim(zsb.type) = '委管组织部后备案干部' then 'B'
      when trim(zsb.type) = '国资委机关局级后备干部' then 'B'
      when trim(zsb.type) = '市管国企领导人员副职后备人选' then 'B'
      when trim(zsb.type) = '处级干部' then 'D'
      when trim(zsb.type) = '企业参照正局、副局' then 'A'
      when trim(zsb.type) = '其他' then 'B'
      when trim(zsb.type) = '—' then 'D'
      end as typeEn
      from zzxk_studentBatch zsb
      

  3.   

    不是说明软件,而是回帖的代码粘贴功能。
    你的问题是,
    case
      when zsb.type = '市管领导干部' then 'A'
    ...
    end as typeEn
    这一段的意思是,当zsb.type的值是"市管领导干部"的时候,"typeEn"列的值就是"A"。
    如此类推,而不是把zsb.type这一列变成"A"。