oracle中怎么用&&,Oracle SQL使用經驗 && Oracle 用left join 更新數據

我這里說的,用left join update數據的是指

有a,b兩表,將b表數據根據某個歸則關聯更新到a表.

Oracle.寫法1  目前用得最多的,  注意: 當b表沒有對應數據時,  a表 xxx欄位會更新為null

update a set a.xxx = (select b.eee from b where a.bid = b.id)

Update emp

Set(sal,comm) = (select sal,comm. From emp1 where emp.empno = emp1.empno)

Oracle.寫法2 用merge

merge into a

using b

on (a.a=b.b)

when matched then update set xxxxx

when not matched then insert (xxx) values(xxx);

其它寫法,Oracle 不支持

update a set a.xxx=b.eee

from a

left  join b on a.bid=b.id

阿飛

2015/04/28

阅读(3385) | 评论(0) | 转发(0) |

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值