删除mysql数据库中的重复数据记录
时间:2021-05-20 09:27:56|栏目:Mysql|点击: 次
采用的是下面的方法可删除,假设重复的是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;
上一篇:MySQL笔记之视图的使用详解
栏 目:Mysql
本文标题:删除mysql数据库中的重复数据记录
本文地址:http://www.codeinn.net/misctech/124948.html