insert into #tmp
select col1, col2,.. from tablename
group by col1, col2,...
where having(count(*)>1);
delete tablename from tablename a, #tmp b
where a.col1=b.col1 and a.col2=b.col2 ...
insert into tablename
select * from #tmp
delete tablename from
(select col1, col2, ...,mix(id) as id from tablename
group by col1, col2, ...) as A
where col1 = A.col1
and col2 = A.col2
and ...
and id <> A.id