use a;//切换表所在数据库
SET SQL_SAFE_UPDATES = 0;
update temp3 as a, temp3 as b set a.test1=b.test3, a.test3=b.test1 where a.id=b.id and a.test4=1 and b.test4=1;
SET SQL_SAFE_UPDATES = 1;
参考链接:https://blog.csdn.net/macwhirr123/article/details/76217919
辅助链接: https://blog.csdn.net/qq_36742720/article/details/81515113