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語句查詢表中重復數據(多類型)創新互聯
網頁地址:http://vcdvsql.cn/news1/146101.html
網站建設、網絡推廣公司-創新互聯,是專注品牌與效果的網站制作,網絡營銷seo公司;服務項目有網站建設、網站導航等
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯
猜你還喜歡下面的內容