
例如这样一张表的话 本人怎么样做才能让a字段的1 2互换
结果是这样
a b
2 hello
1 hi
怎么做呢?
解决方案
10
update tb set a=2 where b=hello;
update tb set a=1 where b=hi;
update tb set a=1 where b=hi;
10
update table1
set a=if(a=2,1,2)
where a in (1,2)
set a=if(a=2,1,2)
where a in (1,2)