备份表的操作,按照一个表的最新数据更新另一个表的某个字段

 

公司需求表的更换片区之后操作整个表的更新

 

买卖需求

createtable mm_xqinfobak asselect  *from  mm_xqinfo

 

update   (select  /*+use_hash(a,b)*/  a.duty_deptnameall  as a5,b.deptnameall  as b5

           from  mm_xqinfo a, oy_department  b  where b.deptid = a.duty_deptid  )     set a5=b5 ;

commit;

 

 

租赁需求

 

createtable zl_xqinfobak asselect  *from  zl_xqinfo

 

update   (select  /*+use_hash(a,b)*/  a.duty_deptnameall  as a5,b.deptnameall  as b5

           from  zl_xqinfo a, oy_department  b  where b.deptid = a.duty_deptid  )     set a5=b5 ;

commit;

 

 

买卖合同

 

createtable mm_cjinfobak asselect  *from  mm_cjinfo

 

update   (select  /*+use_hash(a,b)*/  a.cj_deptnameall  as a5,b.deptnameall  as b5

           from  mm_cjinfo a, oy_department  b  where b.deptid = a.cj_deptid  )     set a5=b5 ;

commit;

 

 

租赁合同

createtable zl_cjinfobak asselect  *from  zl_cjinfo

 

update   (select  /*+use_hash(a,b)*/  a.cj_deptnameall  as a5,b.deptnameall  as b5

           from  zl_cjinfo a, oy_department  b  where b.deptid = a.cj_deptid  )     set a5=b5 ;

commit;

 

买卖房源

createtable mm_fyinfobak asselect  *from  mm_fyinfo

 

update   (select  /*+use_hash(a,b)*/  a.duty_deptnameall  as a5,b.deptnameall  as b5

           from  mm_fyinfo a, oy_department  b  where b.deptid = a.duty_deptid  )     set a5=b5 ;

commit;

 

 

 

租赁房源

createtable zl_fyinfobak asselect  *from  zl_fyinfo

 

update   (select  /*+use_hash(a,b)*/  a.duty_deptnameall  as a5,b.deptnameall  as b5

           from  zl_fyinfo a, oy_department  b  where b.deptid = a.duty_deptid  )     set a5=b5 ;

commit;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值