2022-04-21 分類: 網(wǎng)站導(dǎo)航
select * from hztj a where (a.sdxzqhdm) in (select sdxzqhdm from hztj group by sdxzqhdm having count(*) > 1)
select count(sdxzqhdm) as '重復(fù)次數(shù)',sdxzqhdm from hztj group by sdxzqhdm having count(*)>1 order by sdxzqhdm desc
查詢及刪除重復(fù)記錄的方法select * from hztj
where sdxzqhdm in (select sdxzqhdm from hztj group by sdxzqhdm having count(sdxzqhdm) > 1)
(2)刪除表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段來判斷,只留rowid最小的記錄delete from hztj
where sdxzqhdm in (select sdxzqhdm from hzth group by sdxzqhdm having count(sdxzqhdm) > 1)(3)查找表中多余的重復(fù)記錄(多個(gè)字段)
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)查找表中多余的重復(fù)記錄(多個(gè)字段),不包含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)
網(wǎng)站名稱:sql語句查詢表中重復(fù)數(shù)據(jù)(多類型)創(chuàng)新互聯(lián)
網(wǎng)頁地址:http://aaarwkj.com/news1/146101.html
網(wǎng)站建設(shè)、網(wǎng)絡(luò)推廣公司-創(chuàng)新互聯(lián),是專注品牌與效果的網(wǎng)站制作,網(wǎng)絡(luò)營(yíng)銷seo公司;服務(wù)項(xiàng)目有網(wǎng)站建設(shè)、網(wǎng)站導(dǎo)航等
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容