删除mysql数据库中的重复数据记录方法

数据库评论305字数 85阅读模式

mysql中select distinct * from text不能显示不重复的记录,而是直接全部显示

采用的是下面的方法可删除,假设重复的是test数据库中的title字段很文博客-https://www.zhenjiekeji.com/60132.html

  1. create table bak as (select * from test group by title having count(*)=1);
  2. insert into bak (select * from test group by title having count(*)>1);
  3. truncate table test;
  4. insert into test select * from bak;

 很文博客-https://www.zhenjiekeji.com/60132.html

很文博客-https://www.zhenjiekeji.com/60132.html
weinxin
我的微信
微信号已复制
扫一扫更精彩
大家的支持是我更新的动力!!!
匿名

发表评论

匿名网友