Home > OS >  Update Table1 with the help of Table2
Update Table1 with the help of Table2

Time:07-07

Scenario : Table1 and Table2 has same columns =>Table1 has All data =>Table2 has updated values except "ProductCode"(this one column remain same)

I just want to match productcode from both table and need to update in Table1

table look like this

please help me out

CodePudding user response:

You can do it by this -

Update `Table1` 
  INNER JOIN `Table2` ON (Table1.ProductCode = Table2.ProductCode)
  SET Table1.Category = Table2.Category
  ....

You need to give all fields to be updated.

  • Related