Method 1
Delete yourtable
Where [id] not in (
Select max ([id]) from yourtable
Group by (name + value ))
Method 2
Delete
From table a left join (
Select (id) from Table group by name, value
) B on a. id = B. id
Where B. id is null
SQL statement for querying and deleting duplicate records
SQL statement for querying and deleting duplicate records
1. Search for redundant duplicate records in the Table. duplicate records are determined based on a single field (peopleid ).
Select * from people
Where peopleid in (select peopleid from people group by peopleid having count (peopleid)> 1)
2. Delete unnecessary duplicate records in the Table. Repeat records are determined based on a single field (eagleid), leaving only the records with the smallest 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. Search for redundant duplicate records in the table (multiple fields)
Select * from vitae
Where (a. peopleid, a. seq) in (select peopleid, seq from vitae group by peopleid, seq having count (*)> 1) 1 2 3 4