Answer the question
In order to leave comments, you need to log in
How to rewrite sql overgrown insert to update?
There is a dump.
The format is like this..
INSERT INTO `product_images` (`product_id`, `image`) VALUES
(103, 'shops/1/products/95fd9653b27e9d745ed42c3f553be3c53d2c22d3.png'),
(104, 'shops/1/products/7c195d10be6dc71be339d151225573cf251103f1.png'),
(105, 'shops/1/products/a5c854d236f4b9478dd37a3619b02f060264da80.png'),
(106, 'shops/1/products/2712489054f2704f47cef92722b256846af01602.png'),
(107, 'shops/1/products/5090d07f7377e67b737095868a223807bf425069.png'),
(108, 'shops/1/products/36c4d68cf3a6d2244db4f99429e5ef1d3e7efbf4.png'),
(109, 'shops/1/products/ef6a83b637a57636cae2558fcfa640213b9f7d56.png'),
(110, 'shops/1/p.... и т.д около 2 000 столбцов
Answer the question
In order to leave comments, you need to log in
insert into product_images_tmp, and then update product_images inner join product_images_tmp
ps by the way, in your query there is a mismatch in the number of columns
UPDATE `product_images` SET image = 'shops/1/products/95fd9653b27e9d745ed42c3f553be3c53d2c22d3.png' WHERE product_id = 103
UPDATE `product_images` SET image = 'shops/1/products/95fd9653b27e9d745ed42c3f553be3fd34fd343.png' WHERE product_id = 104
UPDATE `product_images` SET image = 'shops/1/products/95fd9653b27e9d745ed42c3f553b434dfd3rd3e4d3.png' WHERE product_id = 105
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question