问题:
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
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4308065