SQL - 使用另一个表的字段更新一个表
我正在尝试执行以下更新查询:
UPDATE Commodities
INNER JOIN UniqueCountries
ON Commodities.wbCode = UniqueCountries.wbCode
SET Idenb = UniqueCountries.wbName||yr
该查询显然是错误的,因为它不起作用。我该如何修复它?
该查询应该使用 wbName
和 yr
的串联值更新列 IdenB
(wbName||yr
) 。但是,wbName
位于另一个名为 UniqueCountries
的表上,这就是我尝试执行内部联接的原因。
我做错了什么以及如何解决它?非常感谢。
I am trying to execute the following update query:
UPDATE Commodities
INNER JOIN UniqueCountries
ON Commodities.wbCode = UniqueCountries.wbCode
SET Idenb = UniqueCountries.wbName||yr
The query is clearly wrong, as it doesnt work. How can I fix it?
The query is supposed to update column IdenB
with the concatenated value of wbName
and yr
(wbName||yr
). However, wbName
is on another table called UniqueCountries
, which is why I tried to perform an Inner Join.
What am I doing wrong and how can I fix it? Thank you very much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在文档中看不到任何指示
FROM
或 <UPDATE
语句支持 code>JOIN。如果没有,也许您可以尝试相关子查询。
I can't see any indication in the docs that
FROM
orJOIN
are supported inUPDATE
statements.Maybe you could try a correlated sub query if not.