删除mysql数据库中的重复数据记录
程序员文章站
2023-12-01 23:24:58
采用的是下面的方法可删除,假设重复的是test数据库中的title字段 复制代码 代码如下:create table bak as&...
采用的是下面的方法可删除,假设重复的是test数据库中的title字段
create table bak as (select * from test group by title having count(*)=1);
insert into bak (select * from test group by title having count(*)>1);
truncate table test;
insert into test select * from bak;
复制代码 代码如下:
create table bak as (select * from test group by title having count(*)=1);
insert into bak (select * from test group by title having count(*)>1);
truncate table test;
insert into test select * from bak;
上一篇: oracle定时备份压缩的实现步骤