Answer the question
In order to leave comments, you need to log in
Multiple data update?
Good day. I've been banging my head against a seemingly small problem for about an hour now.
You need to update the data with one query in one table.
Or to simplify it:
UPDATE table SET `field`=0 WHERE `id`=1 or `id`=4 or `id`=14 ...
UPDATE table SET `field`=0 WHERE `id` IN(1,4,14...);
Answer the question
In order to leave comments, you need to log in
1. The first request is not completely written, maybe there is limit 1?
2. Maybe you have only one entry from the entire list of IDs?
Well, I would like to note that the result of UPDATE is the number of changed records. If the value of `field` for all entries from the list before the request is 0, then the result is 0 changed entries. Accordingly, if only one record has 1, then the result is 1 modified record.
Well, it works for me:
update tblx set x=0, y=0, z=0
resets to zero for everyone. Maybe you have somewhere Limit wormed its way?
Thanks!!! One bug found! or instead of ,
`id`=1 or `id`=4 or `id`=14…
Hmm… you need to go to bed, otherwise you will have to rewrite everything tomorrow.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question