盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

Mysql删除重复的数据的方法

时间:2023/4/14作者:未知来源:盾怪网教程人气:

[摘要]这篇文章主要介绍了Mysql删除重复的数据 Mysql数据去重复,需要的朋友可以参考下MySQL数据库中查询重复数据select * from employee group by emp_name ...
这篇文章主要介绍了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删除重复的数据的方法的详细内容,更多请关注php中文网其它相关文章!


学习教程快速掌握从入门到精通的SQL知识。



关键词:Mysql删除重复的数据的办法




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版