MYSQL如何查寻表中多余的重复数据(单字段)

2018年3月26日18:55:56 发表评论
  假设现在有一张product表,如何实现查询出userid在表中多余的重复数据
select * from product where userid in (select userid from product group by userid having count(userid) > 1)
上面sql表示通过子查询的方式获取到数据并且分组,最后放在主表中查出重复数据。
在下一篇文章中将描述如何查询多字段的重复数据

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: