Here is one of the most useful SQL commands I know. The example below is a table, Sales_Import, that has incorrect AccountNumber data. So, somebody took the time to put the correct AccountNumber data into a table along with each record’s LeadID.
It is important to note that if the Sales_Import record is NOT in the RetrieveAccountNumber table based on the LeadID, the Sales_Import record has the AccountNumber field populated with null! So, be careful.
UPDATE Sales_Import B
SET AccountNumber =
FROM RetrieveAccountNumber A
WHERE B.State = ‘Michigan’