php - Update mulit rows with one SQL request
Get the solution ↓↓↓How I can update 10 rows with one SQL request
UPDATE gallery_photos SET queue=:queue WHERE id = :id AND SET queue=:queue2 WHERE id = :id2";
something like this
Answer
Solution:
You can do this with:
UPDATE gallery_photos
SET queue = (CASE WHEN id = :id THEN :queue
WHEN id = :id2 THEN :queue2
ELSE queue -- strictly speaking, this is not not be necessary because of the outer `WHERE`
END)
WHERE id IN (:id, :id2);
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: warning: a non-numeric value encountered in
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.