34,576
社区成员
发帖
与我相关
我的任务
分享
#1. 将需要删除的数据放到一个新表
create table tmp select * from tbName where 条件 ;
#2. 将原表中的数据删除
delete from tbName where 条件 ;
#3. 将 tmp 表中的数据插入到原表(主键按你的需求变动) :
insert into tbName (pkId, c1,c2,... )
select id+xxxx,c1,c2,...
from tmp;
#4. 确定没有问题, 删除 tmp 表
drop table tmp;