mysql查看数据表是否有重复数据


我们可以用

  select * from people  where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)  
select * from Users where UserId in (select UserId from Users  group by UserId having count(UserId) > 1)  

不过在数据量过大的时候查询的速度会非常慢


select count(peopleId) from people 
select count(distinct peopleId) from people  
我们可以用上面两条语句的结果进行对比判断是否存在重复数据


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM