I need to update multiple rows with one query. For the insert we usually do something like
INSERT INTO `table` (c1,c2,c3) VALUES
(1,2,3),
(4,5,6),
..
Yet how can we do something similar for the update where each row has different values than the other? And there is a condition that is related to the id of each row?
Any one faced similar issue?
Example of how I have to do the update now is:
UPDATE questions
SET lab='What sections do you believe the site must not have?',
type='textarea',
options=''
WHERE rnum=11;
UPDATE questions
SET lab='What is your favourate section?',
type='radio',
options='section1,section2,section3,section4,section5'
WHERE rnum=12;
And so on. Definitely this is the worst way to do it because every query needs to be executed, and there may be as many as 20.