Answer the question
In order to leave comments, you need to log in
What is the best way to do an UPDATE query on the same column for 200 rows in MySQL?
Need to UPDATE 200, and in the future up to 1000 rows in MySQL. We update the value of only one column `Value`. We are looking for the column `ID` and update `Value`. What is the best way to write a query?
It is clear that doing the UPDATE command 200 times is not an option))
And how many maximum rows can be updated in one request so that everything does not die?
Answer the question
In order to leave comments, you need to log in
In the end I solved it like this:
UPDATE table
SET value = CASE id
WHEN 1 THEN 'a'
WHEN 2 THEN 'b'
WHEN 3 THEN 'c'
END
WHERE id IN (1,2,3)
Well, 200, well, 1000 - do it on parameterized cursors and don't worry.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question