I am having a problem updating several rows of a mysql table using a single mysql statement.
I have the rowids i want to update in a string eg.
$ids="id1, id2, id3, id4,...."
and i have my values in another string eg.
$values="str1, str2, str3, str4,....";
(i have more than 30,000 rows to update)
The idea is the row with id1 should be updated with str1 and so on.
How can i fix this?
Thanks
It's going to be a very ugly query but...
update table
set str = case id
when id1 then str1
when id2 then str2
...
end
where id in (id1, id2, ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With