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

后端 未结 22 1310
太阳男子
太阳男子 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:15

    try this :

    UPDATE
        Table_A
    SET
        Table_A.AccountNumber = Table_B.AccountNumber ,
    FROM
        dbo.Sales_Import AS Table_A
        INNER JOIN dbo.RetrieveAccountNumber AS Table_B
            ON Table_A.LeadID = Table_B.LeadID 
    WHERE
        Table_A.LeadID = Table_B.LeadID
    

提交回复
热议问题