by Nathan
13. July 2009 06:41
If you want to update the data in a table by getting information from another table. You can acheive this by using an update inner join query.
For example if i wanted to update the phone numbers in my table using a list of contacts from a secondary table, the UPDATE INNER JOIN Query would be like the one below:
UPDATE c
SET c.PhoneNumber = c2.PhoneNumber
FROM Contact AS c
INNER JOIN ContactTable2 c2 on c.Id = c2.Id
WHERE DateCreated > GETDATE()-60
59abb847-3c83-4e89-a84c-9cc2fe426cc7|1|5.0
Tags: sql
SQL