一、查找表中多餘的重複記錄,重複記錄是根據單個字段(peopleId)來判斷html
select * from people where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
二、查找表中多個字段的重複記錄sql
select * from vitae a where (a.peopleId,a.seq) in (select peopleId,seq from vitae group by peopleId,seq having count(*) > 1)
三、查某一列(或多列)的重複值(只能夠查出重複記錄的值,不能查出整個記錄的信息)ui
查找stuid,stuname重複的記錄spa
select stuid,stuname from stuinfogroup by stuid,stunamehaving(count(*))>1
參考資料: sql查詢重複記錄 http://www.studyofnet.com/news/918.htmlcode