如何在SQL中使用JOIN执行UPDATE语句?

假装没事ソ 提交于 2020-10-25 12:47:32

问题:

I need to update this table in SQL Server 2005 with data from its 'parent' table, see below: 我需要使用其“父”表中的数据更新SQL Server 2005中的此表,请参见下文:

sale 销售

id (int)
udid (int)
assid (int)

ud ud

id  (int)
assid  (int)

sale.assid contains the correct value to update ud.assid . sale.assid包含更新ud.assid的正确值。

What query will do this? 什么查询将执行此操作? I'm thinking a join but I'm not sure if it's possible. 我正在考虑join但不确定是否可行。


解决方案:

参考一: https://stackoom.com/question/5QSA/如何在SQL中使用JOIN执行UPDATE语句
参考二: https://oldbug.net/q/5QSA/How-can-I-do-an-UPDATE-statement-with-JOIN-in-SQL
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!