我还在学习SQL。我以两种不同的方式完成了类似的查询,并且想知道哪个更好以及为什么。
UPDATE R
SET R.something = 1
FROM Table1 R
JOIN Table2 U
ON R.value1 = U.value2
WHERE
U.value3 BETWEEN 1 AND 5
或者
UPDATE R
SET R.something = 1
WHERE R.value1 IN
(SELECT U.value2
FROM U
WHERE
U.value3 BETWEEN 1 AND 5
)