`

CASE语句的使用

 
阅读更多
1.有条件的级联更新
--update stu.st_rsvr_r1 t3 set t3.belonggd = (select case when t1.addvcd like '44%' then '1'  from stu.st_stbprp_b t1,stu
update stu.st_rsvr_r1 t3 set t3.belonggd =(
select
      case
         when t1.addvcd like '44%' then
          '1'
          else '0'
       end b

  from stu.st_stbprp_b t1 where t1.stcd = t3.stcd) where exists(select 1 from stu.st_stbprp_b t2 where t2.stcd = t3.stcd)
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics