SQL交换两行的数据

UPDATE `order` t1 
JOIN `order` t2
ON (t1.sfzh ='x' AND t2.sfzh = 'x')
SET t1.`exam_id` = t2.`exam_id`,t1.`site_id`=t2.`site_id`,t2.`exam_id` = t1.`exam_id`,t2.`site_id`=t1.`site_id`;

  

posted @ 2022-06-09 16:47  X__cicada  阅读(359)  评论(0编辑  收藏  举报