Mysql删除重复的数据 Mysql数据去重复
MySQL数据库中查询重复数据
select * from employee group by emp_name having count (*)>1;
Mysql 查询可以删除的重复数据
select t1.* from employee t1 where (t1.emp_name) in (select t4.emp_name from (select t2.emp_name from employee t2 group by t2.emp_name having count(*)>1) t4) and t1.emp_id not in (select t5.emp_id from (select min(t3.emp_id) as emp_id from employee t3 group by t3.emp_name having count(*)>1) t5);
Mysql 删除重复的数据
delete t1 from employee t1 where (t1.emp_name) in (select t4.emp_name from (select t2.emp_name from employee t2 group by t2.emp_name having count(*)>1) t4) and t1.emp_id not in (select t5.emp_id from (select min(t3.emp_id) as emp_id from employee t3 group by t3.emp_name having count(*)>1) t5);
相关文章
MySQL 启动报错:File ./mysql-bin.index not found (Errcode: 13)
这篇文章主要介绍了MySQL 启动报错:File ./mysql-bin.index not found (Errcode: 13)的解决方法,需要的朋友可以参考下2014-07-07
安装配置mysql及Navicat prenium的详细流程
这篇文章主要介绍了安装配置mysql及Navicat Premium的详细流程,配置方法也真的很简单,本文给大家详细介绍mysql Navicat Premium安装配置相关知识感兴趣的朋友,一起学习吧2021-06-06


最新评论