mysql - A multitude of the same id in an WHERE id IN () statement -
I have a simple query, which increases the value of the field by 1. Now I was looping on all the IDs and the fire seemed to be a query for each of them, but now these things are getting huge resources, I want to customize it. Normally I'll just update table SET field = field + 1 WHERE id (all id here) but now I have problems that there is ID That's twice (or more, I can not know on forehand). If the query looks like this, there is a way to run twice for ID4: UPDATE table SET field = field + 1 WHERE id IN (1, 2, 3, 4, 4) , 5) thanks, lordstyx Edit: Sorry for not being clear enough. ID here is an Auto Ink field, so it's all unique ID. The ID that is to be updated is coming indirectly from users, so I can not predict which ID is going to be made if IDs are (1, 2, 3, 4, 4, 5) I have to increase the line area with ID 4 to 2, and with all the rest 1. if (1, 2, 3, 4, 4, 5) Comes with a SELECT id. query, you can do something like this: Add your table...