I am sure it was asked before, but it was difficult for me to find it.
I have several groups of duplicates in one table (3 records for one, 2 for another, etc.) - several rows where there are more than 1.
Below I tried to remove them, but I need to run the script for many duplicates:
set rowcount 1
delete from Table
where code in (
select code from Table
group by code
having (count(code) > 1)
)
set rowcount 0
It works well. I need to run this for each group of duplicates, and then it removes only 1 (which is all I need right now).
I appreciate your help / comments!
source
share