I have a database with account numbers and card numbers. I match these to a file to update any card numbers to the account number so that I am only working with account numbers.
I created a view linking the table to the account/card database to return the Table ID and the related account number, and now I need to update those records where the ID matches the Account Number.
This is the Sales_Import table, where the account number field needs to be updated:
And this is the RetrieveAccountNumber table, where I need to update from:
I tried the below, but no luck so far:
SET [AccountNumber] = (SELECT RetrieveAccountNumber.AccountNumber
WHERE [Sales_Lead].[dbo].[Sales_Import]. LeadID =
It updates the card numbers to account numbers, but the account numbers get replaced by NULL