If the number of columns that has this problem is limited, and all those columns are numeric or textual and only contain values 0 or 1, you can do this PER column that has the problem:
update myTable set myColumn = '2' where myColumn = '1';
update myTable set myColumn = '1' where myColumn = '0';
update myTable set myColumn = '0' where myColumn = '2';
If the columns are enum, you will need an alternative approach. (A nice work-around would be to null
or empty string instead of 2
, but that can only be done if the column then is not-null.)
edit
It can be done more simple, and it doesn't matter what the type of the columns is.
If you don't expect nulls:
update myTable set myColumn = if(myColumn='1','0','1');
If nulls should stay nulls:
update myTable set myColumn = if(myColumn is null, null, if(myColumn='1','0','1'));
If nulls should become 1:
update myTable set myColumn = if(myColumn is null, '1', if(myColumn='1','0','1'));