MySQL Forums
Forum List  »  Newbie

UPDATE a field SEVERAL times in 1 UPDATE
Posted by: Bigcrime Crimebig
Date: August 18, 2010 09:18PM


this is a not working example of what I want to do:

UPDATE casinogamers SET bucks = bucks+1 WHERE id IN ('1','2','4','3','4','4');

in this example id 4 is repeated 3 times, but it will be updated just one time.

I want to tell mysql that update each id each time they appear inside IN (...).

NOTE: this is just an example, in my script, I dont know the ID numbers I only know they were recollected by PHP, I dont know how many times they are repeated or which one is repeated. Nother thing you have to know is that the IDs always will be more than 2 millions and update IDs one by one is too much delay, so for this reason I created this topic.

So I think is clear what I need:

UPDATE "each" id "each" time they appear inside IN (...).

Ill appreciate very much your help.

Edited 1 time(s). Last edit at 08/18/2010 09:19PM by Bigcrime Crimebig.

Options: ReplyQuote

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.