`
terry0501
  • 浏览: 306751 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

sql 根据身份证前两位更新省份

阅读更多
update ccms_acct_customer set province = case left(cid,2)
  when '11' then '北京市'
  when '12' then '天津市'
  when '13' then '河北'
  when '14' then '山西'
  when '15' then '内蒙'
  when '21' then '辽宁'
  when '22' then '吉林'
  when '23' then '黑龙江'
  when '31' then '上海'
  when '32' then '江苏'
  when '33' then '浙江'
  when '34' then '安徽'
  when '35' then '福建'
  when '36' then '江西'
  when '37' then '山东'
  when '41' then '河南'
  when '42' then '湖北'
  when '43' then '湖南'
  when '44' then '广东'
  when '45' then '广西'
  when '46' then '海南'
  when '50' then '重庆'
  when '51' then '四川'
  when '52' then '贵州'
  when '53' then '云南'
  when '54' then '西藏'
  when '61' then '陕西'
  when '62' then '甘肃'
  when '63' then '青海'
  when '64' then '宁夏'
  when '65' then '新疆'
  when '71' then '台湾'
  when '81' then '香港'
  when '82' then '澳门' end
  where cust_id in (SELECT cust_id from ccms_case_main where stra_id='W1' and (collect_area is null or collect_area='') and collector is null)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics