Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete until unique..?

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
SE
Hi all,

I have a script that looks for duplicates and deletes them:
================================
select Cnt=min(Cnt)
into #temp
from Tbl1
group by BusinessPartnerNumber
having count(BusinessPartnerNumber)>1

DELETE Tbl1
FROM Tbl1 k INNER JOIN #temp t
ON k.cnt = t.cnt
=================================

I would like to repeate this until there is no more duplicates.

How can I do this?
 
take a look at:


good article about duplicates - you have to be careful as what you are doing above may end up deleting all records where there was more than one occurence but infact you actually want to leave one record.

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top