If you want to update every second row (actually its updating odd and even rows in MySQL table) then this is a small trick i found on one 7 years old printout.
So the problem with me was that i accidentally updated one enum column on all rows so this table…
+---+---+
| 1 | A |
| 2 | b |
| 3 | A |
| 4 | b |
| 5 | A |
+---+---+
…turned out to have B’s everywhere, but i just wanted to capitalize them where they are…
+---+---+
| 1 | B |
| 2 | B |
| 3 | B |
| 4 | B |
| 5 | B |
+---+---+
…first i got depressed (because manually changing 1000 rows wasnt included in todays plans), so i remember i had something similar many years ago and guess what – found it. Solution was to use mod() to detect if row id was odd or even…
update `table1` set value='A' where MOD(id,2) = 1;
update `table1` set value='B' where MOD(id,2) = 0;
… and voila! my day (night, actually) is saved…
+---+---+
| 1 | A |
| 2 | B |
| 3 | A |
| 4 | B |
| 5 | A |
+---+---+
Of course, it doesnt help you if id’s are mixed or even more sad – no id’s at all. Well, if you know better solution – would be appreciated.