how do I do multiple updates within same query.
Lets say I have this query
UPDATE table1
SET
Order = 1
WHERE
ID = 1234
But I want to change some more orders where IDs are 2345 and 2837 and 8399
how would I do that within same mysql query. Please notice that Order may be different than 1 for those. as order field is unique.
If you need different values of
Orderfor each id, then you probably want to put a loop in whatever program is talking to the database.Edited to add
I was thinking of looping in a program, but I see you want to execute the SQL interactively.
If you’re trying to bundle a sequence of unpredictable numbers like this:
…then I’m not sure how you want that to be shorter. You can write a stored procedure that gets called like this:
Is that what you have in mind?