MySQL同表A和B字段值互换

update 
    table t1, table t2
set 
  t1.field1 = t2.field2,
  t1.field2 = t2.field1 where t1.id = t2.id;
posted @ 2022-08-15 08:53  coolw  阅读(228)  评论(0)    收藏  举报