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

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

    The simple Way to copy the content from one table to other is as follow:

    UPDATE table2 
    SET table2.col1 = table1.col1, 
    table2.col2 = table1.col2,
    ...
    FROM table1, table2 
    WHERE table1.memberid = table2.memberid
    

    You can also add the condition to get the particular data copied.

提交回复
热议问题