SQL update from one Table to another based on a ID match

后端 未结 22 1311
太阳男子
太阳男子 2020-11-21 22:49

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

22条回答
  •  悲&欢浪女
    2020-11-21 23:22

    Seems you are using MSSQL, then, if I remember correctly, it is done like this:

    UPDATE [Sales_Lead].[dbo].[Sales_Import] SET [AccountNumber] = 
    RetrieveAccountNumber.AccountNumber 
    FROM RetrieveAccountNumber 
    WHERE [Sales_Lead].[dbo].[Sales_Import].LeadID = RetrieveAccountNumber.LeadID
    

提交回复
热议问题