update
table t1, table t2
set
t1.field1 = t2.field2,
t1.field2 = t2.field1
where
t1.id = t2.id;
MySQL同表A和B字段值互换
于 2022-08-15 08:53:00 首次发布
update
table t1, table t2
set
t1.field1 = t2.field2,
t1.field2 = t2.field1
where
t1.id = t2.id;