日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
sql查詢重復(fù)記錄、刪除重復(fù)記錄具體方法

本篇文章重點(diǎn)為大家講解一下sql查詢重復(fù)記錄、刪除重復(fù)記錄具體方法,有需要的小伙伴可以參考一下。

鳳岡ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!

查找所有重復(fù)標(biāo)題的記錄:

SELECT *
FROM t_info a
WHERE ((SELECT COUNT(*)
FROM t_info
WHERE Title = a.Title) > 1)
ORDER BY Title DESC

一、查找重復(fù)記錄

1.查找全部重復(fù)記錄

Select * From 表 Where 重復(fù)字段 In (Select 重復(fù)字段 From 表 Group By 重復(fù)字段 Having Count(*)>1)

2.過濾重復(fù)記錄(只顯示一條)

Select * From HZT Where ID In (Select Max(ID) From HZT Group By Title)

注:此處顯示ID最大一條記錄

二、刪除重復(fù)記錄

1.刪除全部重復(fù)記錄(慎用)

Delete 表 Where 重復(fù)字段 In (Select 重復(fù)字段 From 表 Group By 重復(fù)字段 Having Count(*)>1)

2.保留一條記錄

Delete HZT Where ID Not In (Select Max(ID) From HZT Group By Title)

注:此處保留ID最大一條記錄

刪除多余的重復(fù)記錄

1.查找表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段(peopleId)來判斷

select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)

2.刪除表中多余的重復(fù)記錄,重復(fù)記錄是根據(jù)單個(gè)字段(peopleId)來判斷,只留有rowid最小的記錄

delete from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
and rowid not in (select min(rowid) from people group by peopleId having count(peopleId )>1)

3.查找表中多余的重復(fù)記錄(多個(gè)字段)

select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)

4.刪除表中多余的重復(fù)記錄(多個(gè)字段),只留有rowid最小的記錄

delete from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

5.查找表中多余的重復(fù)記錄(多個(gè)字段),不包含rowid最小的記錄

select * from vitae a
where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
and rowid not in (select min(rowid) from vitae group by peopleId,seq having count(*)>1)

分享名稱:sql查詢重復(fù)記錄、刪除重復(fù)記錄具體方法
網(wǎng)站網(wǎng)址:http://www.5511xx.com/article/djieoii.html