赞
踩
1.表中有id和name 两个字段,查询出name重复的所有数据
select * from xi a where (a.username) in (select username from xi group by username having count(*) > 1)
2、查询出所有数据进行分组之后,和重复数据的重复次数的查询数据,先列下:
select count(username) as ‘重复次数’,username from xi group by username having count(*)>1 order by username desc
3、查找表中多余的重复记录,重复记录是根据单个字段(openid)来判断
SELECT * FROM weixin_user where openid in ( select openid from weixin_user group by openid having count(*) > 1)
4、查找表中多余的重复记录(多个字段:openid,nickname)
SELECT * FROM weixin_user where (openid,nickname) in ( select openid,nickname from weixin_user group by openid,nickname having count(*) > 1)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。