我有2张表A和B
表A
paid_month budget amount
201703 11401 23000
201703 11401 24000
201703 11401 12000
表B喜欢
paid_month budget amount
201703 11402 23000
201703 11403 24000
201703 11404 12000
现在我想更新表A中的预算,如下所示
设置A.budget
= B.budget
其中A.amount
= B.amount
答案 0 :(得分:0)
Oracle不支持更新连接语法,但您仍然可以使用具有相关子查询的更新来实现所需的目标:
UPDATE tableA a
SET budget = (SELECT b.budget FROM tableB b
WHERE a.amount = b.amount AND a.paid_month = b.paid_month)