update column in sql from another table code example
Example 1: sql server update column based on another table
UPDATE
Sales_Import
SET
Sales_Import.AccountNumber = RAN.AccountNumber
FROM
Sales_Import SI
INNER JOIN
RetrieveAccountNumber RAN
ON
SI.LeadID = RAN.LeadID;
Example 2: sql update with field from another table
UPDATE table1
SET price=(SELECT price FROM table2 WHERE table1.id=table2.id);