方式一
update 表名 set 字段名=case when 字段名=0 then 1 else 0 end
方式二
update 表名 set 字段名=abs(字段名-1)
示例
update students set gender = abs(gender - 1) where id = 1;
update students set gender=case when gender=0 then 1 else 0 end where id = 1;
方式一
update 表名 set 字段名=case when 字段名=0 then 1 else 0 end
方式二
update 表名 set 字段名=abs(字段名-1)
示例
update students set gender = abs(gender - 1) where id = 1;
update students set gender=case when gender=0 then 1 else 0 end where id = 1;