Possible Duplicate:
How to remove duplicate records in a table?
I’m having one table which contains one of the column with ProjectID which has duplicate records in the table. And table having Primary key column. I want to keep one record & delete the rest duplications.
Following query is to find the total number of duplicate records with the no. of occurrences-
SELECT ProjectID,
COUNT(ProjectID) AS NumOccurrences
FROM MyTable
GROUP BY ProjectID
HAVING ( COUNT(ProjectID) > 1 )
How to do this?
Thanks.
1 Answer