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使用insert into select插入查出的数据
这篇文章主要介绍了mysql使用insert into select插入查出的数据方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教2023-12-12Windows Server 2003 下配置 MySQL 集群(Cluster)教程
这篇文章主要介绍了Windows Server 2003 下配置 MySQL 集群(Cluster)教程,本文先是讲解了原理知识,然后给出详细配置步骤和操作方法,需要的朋友可以参考下2015-06-06innodb 库的备份注意点(由phpmyadmin引起的解决方案)
新版本xampps 1.8.5 X64 集成了phpmyadmin最新版本(4.1.0), 可每次初始化安装程序后, 进入phpmyadmin管理工具, 就会发现phpmyadmin高级功能失效, 一直在提示数据表不存在, 经过再三的分析, 终于找到原因2013-12-12
最新评论