0

I have the following MS SQL query:

    MERGE drivessold as T USING specs as S ON
    drivessold.SKU = specs.SKU_num
    WHEN MATCHED THEN
    UPDATE SET 
    drivessold.color = specs.color, 
    drivessold.speed = specs.speed;

How do I perform a similar query in mySQL?

Note: the SKU and SKU_num are not the keys in the table (this is unique).

Saqib Ali
  • 3,953
  • 10
  • 55
  • 100
  • Possible duplicate of [Is merge statement available in MySQL](https://stackoverflow.com/questions/42663074/is-merge-statement-available-in-mysql) – P.Salmon Jun 20 '18 at 06:56

1 Answers1

1

In mysql you need join for this operation

UPDATE drivessold 
JOIN specs ON drivessold.SKU = specs.SKU_num
SET drivessold.color = specs.color, 
drivessold.speed = specs.speed;
M Khalid Junaid
  • 63,861
  • 10
  • 90
  • 118