Curtis Long
asked on
SQL Server 2008 search for and remove dulpicates
I have a table called plant. A column called certificate.
Is there a way to check the column certificate for duplicates and remove all but one original??
Is there a way to check the column certificate for duplicates and remove all but one original??
ASKER
If I have 10 certificates as follows:
10003
10004
10005
10006
10007
10008
10009
10010
10011
Now the certificates 10003 and 10007 are duplicated.
There should NEVER be two of the same numbers in this column.
Is there a way to delete the dulpicate or set it to flag it some how?? IE highlight etc??
10003
10004
10005
10006
10007
10008
10009
10010
10011
Now the certificates 10003 and 10007 are duplicated.
There should NEVER be two of the same numbers in this column.
Is there a way to delete the dulpicate or set it to flag it some how?? IE highlight etc??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if so, you can use
DELETE FROM plant
WHERE PlantID NOT IN (
SELECT MIN(PlantID), Certificate
GROUP BY Certificate)