Are these two statements equivalent?
UPDATE Table1 SET Field1=(
SELECT Field2 FROM Table2
WHERE Table1.ID=Table2.ID
)
FROM Table1
WHERE Field1 is null
UPDATE t SET Field1=(
SELECT Field2 FROM Table2
WHERE t.ID=Table2.ID
)
FROM Table1 t
WHERE Field1 is null
I am trying to reduce the number of aliases. I feel that adding an alias to the statement only adds another table name to track mentally.
My concern is that in Example 1, since I am not using an alias, it will update the entire table1 instead of filtering on WHERE. Field1 is null.
What is the thumb rule when smoothing is required?
source
share