本文介绍了带联接的SQL更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有当前从 table2.oldData 填充的数据 table1.fieldToChange ...,但我想对其进行更新并将其更改为 table2. newData
I have data table1.fieldToChange that is currently populated from table2.oldData... but I would like to update this and change it to table2.newData
这是我用来尝试实现此目标的代码:
Here's the code I am using to try and achieve this:
UPDATE table1 SET table1.fieldToChange = (SELECT table2.newData FROM table2 WHERE table2.oldData = table1.newData ) ;但是我收到"ORA-01427"错误.
But I get an 'ORA-01427' error.
table2.newData 和 table2.oldData 都是唯一的标识符,在数据库中仅使用一次.任何帮助将不胜感激!
Both table2.newData and table2.oldData are unique identifiers and only used once in the database. Any help would be much appreciated!
谢谢
推荐答案您不是故意的吗?
UPDATE table1 SET fieldToChange = (SELECT table2.newData FROM table2 WHERE table2.oldData = table1.fieldToChange ---- and NOT table1.newData ? ) ;更多推荐
带联接的SQL更新
发布评论