I have a table T1
which contains three columns: Id, Name, Address
There is another table T2
which contains 2 columns Id, New_Address
. Id
column of T2
is same as of T1
.
I need a query which will update Address
column of T1
with New_Address
of T2
.
I can do it through a loop by checking ID and executing update statement. How can it has to be done with a query?
How about
UPDATE T1 SET Address = T2.New_Address FROM T2 WHERE T1.id = T2.id
UPDATE T1 SET T1.Address = T2.New_Address FROM T1 INNER JOIN T2 ON T2.ID = T1.ID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With