使用选择查询更新表

如果仅满足where子句中的语句,我尝试从desiredValue表中更新updatedTable,否则不应该设置值。下面是正确的陈述吗?

 update updatedTable si  
 set desiredValue = select desiredValue
                    from otherTable sl 
                    where sl.att1 = si.att1 and sl.att2 = si.att2;
beautiful_ones 回答:使用选择查询更新表

尝试如下:

UPDATE updatedTable
set updatedTable.desiredValue = otherTable.desiredValue
FROM otherTable
WHERE updatedTable.att1 = otherTable.att1 and updatedTable.att2 = otherTable.att2
本文链接:https://www.f2er.com/3147127.html

大家都在问