如何使用一个SQL请求更新10行
UPDATE gallery_photos SET queue=:queue WHERE id = :id AND SET queue=:queue2 WHERE id = :id2";
类似这样的事情
答案 0 :(得分:2)
你可以这样做:
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);