I have a table like this:
| 0 | X |
| 1 | X |
| 2 | X |
| 3 | Y |
| 4 | Y |
| 5 | X |
| 6 | X |
| 7 | Y |
| 8 | Y |
| 9 | X |
I want to replace the first 2 entries Xwith X1, and then the next 4 entries with X2, so that the resulting table looks like this:
| 0 | X1 |
| 1 | X1 |
| 2 | X2 |
| 3 | Y |
| 4 | Y |
| 5 | X2 |
| 6 | X2 |
| 7 | Y |
| 8 | Y |
| 9 | X2 |
The table in question is, of course, much larger, and the number of occurrences will thus be higher, so manual editing is not a solution.
I would like to do something like this:
UPDATE table SET column = 'X' WHERE column = 'X2' LIMIT 90, 88
but unfortunately MySQL doesn't seem to support OFFSET in UPDATE queries ... Is there a way to do this?
source
share