case语句按条件更新数据列

来源:互联网 发布:linux 关闭tomcat 编辑:程序博客网 时间:2024/04/28 06:41
update s_dr
set dpt_no = (
select dpt_no = 
case
when dpt_name = '保健科' then 'K0001'
when dpt_name = '便民门诊' then 'K0002'
when dpt_name = '大内科(普内科)' then 'K0003'
when dpt_name = '风湿免疫科' then 'K0004'
end
from s_dr a
where s_dr.id=a.id
)
原创粉丝点击