晚上大家,
事实上,已经是晚上了。晚上11点左右。我的大脑正在停止运转,我需要一些帮助,这样我才能完成并回家:)
我有两张表 - 表 a 和表 b。
当其他两个字段匹配时,我需要使用表 b 中的字段值更新表 a 中的字段。表中的每条记录没有唯一的 ID :(
基本上,我想这样做:
update a
set importantField =
(select b.importantfield
from b
where a.matchfield = b.matchfield
and a.matchfield2 = b.matchfield2
)
where a.matchfield = b.matchfield
and a.matchfield2 = b.matchfield2
或者至少...我想这就是我想做的...
有人可以帮我吗?
您可以通过加入更新来执行此操作:
Update a
Set a.importantField = b.importantField
From a Join b
On a.matchfield = b.matchfield
And a.matchfield2 = b.matchfield2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)