當前位置:主頁 > 網站優化 >

織夢網站MYSQL查詢重復記錄的方法

奕星seo偽原創
作者: 奕星SEO 分類: 網站優化 發布時間: 2020-03-17 02:52 內容來源:網絡整理閱讀量:

織夢網站MYSQL查詢重復記錄的方法 織夢無憂 標簽調用 2020-03-14 12:04

摘要: 1、查找表中多余的重復記錄,重復記錄是根據單個字段(peopleId)來判斷 select * from people where peopleId in (select peopleId from people group by peopleId having count(peopleId) 1) 2、刪除表中多余的重復記錄,重復記錄是根據單個字段(peopleId

1、查找表中多余的重復記錄,重復記錄是根據單個字段(peopleId)來判斷

select * from people   

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

2、刪除表中多余的重復記錄,重復記錄是根據單個字段(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、查找表中多余的重復記錄(多個字段)

select * from vitae a   

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

4、刪除表中多余的重復記錄(多個字段),只留有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、查找表中多余的重復記錄(多個字段),不包含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)   

本文鏈接:

版權聲明:本站資源均來自互聯網或會員發布,如果侵犯了您的權益請與我們聯系,我們將在24小時內刪除!謝謝!


本文鏈接地址:http://www.pxynqa.icu/webyouhua/26314.html
上一篇:<<織夢文章命名規則{cc}還原真實文章id便于實現偽靜態
下一篇:織夢會員郵件驗證通知在https域名下驗證鏈接404錯誤的解決方法>>
吉林时时历史开奖号码 欢聚龙江麻将正宗的 江苏十一选五任三推 成都小姐一条龙服务 日本av女拍摄现场 澳洲幸运10开奖 08年史上最全日本av女优资料 熊猫麻将代理利润 甘肃十一选五 中国对西班牙直播比分 辽宁十二选五一定牛 a片里的按摩棒 篮球世界杯比赛比分结果 陕西十一选五任三遗 东京热精华合集 昆明按摩会所那里有00后小妹 11选5开奖浙江