UPDATE table1
SET
table1.field1 = table2.field1,
table1.field2 = table2.field2,
table1.field3 = table2.field3,
table1.fieldn = table2.fieldn
JOIN
table1 ON table2.joinfield = table1.joinfield
我在Oracle中遇到错误(Toad for Oracle):ORA-00933:SQL命令未正确结束
答案 0 :(得分:0)
这可以使用MERGE语法来缩小:
merge into table1 t1
using (
select field1, field2, field3, joinfield
from table2
where table2.field1 = 0
) merge_set
on (
t1.joinfield = merge_set.joinfield
)
when matched then update
set
t1.field1 = merge_set.field1,
t1.field2 = merge_set.field2,
t1.field3 = merge_set.field3
另外,请查看reference provided by @Ben in comments处的问题。