Yes, you can update a table based on another table using T-SQL Update
and Inner Join
Statements.
For example,
Consider you have two tables as below:
Here you can update the Name
value in the first table (T1) based on the matched values in the second table (T2) using this query:
UPDATE
t2
SET
t2.id = t1.id,
t2.[name] = t1.[name]
FROM
t1
INNER JOIN t2
ON t1.id = t2.id
WHERE
t1.name = 'ali'
Here is the result of two tables after running the above update and inner join query
Hope it helps!