2022-04-21 分类: 网站导航
select * from hztj a where (a.sdxzqhdm) in (select sdxzqhdm from hztj group by sdxzqhdm having count(*) > 1)
select count(sdxzqhdm) as '重复次数',sdxzqhdm from hztj group by sdxzqhdm having count(*)>1 order by sdxzqhdm desc
查询及删除重复记录的方法select * from hztj
where sdxzqhdm in (select sdxzqhdm from hztj group by sdxzqhdm having count(sdxzqhdm) > 1)
(2)删除表中多余的重复记录,重复记录是根据单个字段来判断,只留rowid最小的记录delete from hztj
where sdxzqhdm in (select sdxzqhdm from hzth group by sdxzqhdm having count(sdxzqhdm) > 1)(3)查找表中多余的重复记录(多个字段)
select * from hztj a
where (a.sdxzqhdm,a.edxzqhdm) in (select sdxzqhdm,edxzqhdm from hztj group by sdxzqhdm,edxzqhdm having count(*) > 1)
delete from hztj a
where (a.sdxzqhdm,a.edxzqhdm) in (select sdxzqhdm,edxzqhdm from hztj group by sdxzqhdm,edxzqhdm having count(*) > 1)(5)查找表中多余的重复记录(多个字段),不包含rowid最小的记录
select * from hztj a
where (a.sdxzqhdm,a.edxzqhdm) in (select sdxzqhdm,edxzqhdm from hztj group by sdxzqhdm,edxzqhdm having count(*) > 1)
and rowid not in (select min(rowid) from hztj group by sdxzqhdm,edxzqhdm having count(*)>1)
当前名称:sql语句查询表中重复数据(多类型)创新互联
文章来源:/news/146101.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有网站建设、网站导航等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联
猜你还喜欢下面的内容