In thousands of records, there are some of the same records, how can you use SQL statements, delete duplicates? Thank you! 1, find redundant records in the table, duplicate records are judged by a single field (Peopleid) select * from people where peopleid in (select peopleid from People group by peopleid having count (peopleId) > 1) 2, delete redundant records in the table, repeat records are based on a single field (Peopleid) to judge, leaving only the ROWID minimum records 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, redundant duplicate records in lookup table (multiple fields) select * from vitae a where (A.PEOPLEID,A.SEQ) in (select Peopleid,seq from vitaE group by peopleid,seq having count (*) > 1) 4, Delete extra duplicate records (multiple fields) in the table, leaving only the ROWID minimum Records 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, redundant duplicate records in lookup table (multiple fields), does not contain ROWID minimum records 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) For example, there is a field "name" in Table A, and the " Name "value may be the same, now is the need to query out the table in the variousThe "name" value exists for duplicate entries; select name,count (*) from a group by name having count (*) > 1 If the gender is also the same as large as follows: select name,sex,count (*) From A Group by name,sex having count (*) > 1
Delete duplicate records