Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can any tell me the syntax for identifying Duplicates within a table and how to delete those.
Posted

see here[^]
 
Share this answer
 
Comments
Maciej Los 8-May-14 3:07am    
+5
Vi(ky 8-May-14 3:09am    
thanks
The simplest way is:
SQL
SELECT FieldName, COUNT(FieldName) AS Counter
FROM TableName
GROUP BY FieldName
HAVING COUNT(FieldName)>1


For further information, please see: Find and/or Delete Duplicate Rows [^]
 
Share this answer
 
Alternative suggestion.

First of all, why do you allow duplicate values. Check these
0) Constraints[^]
1) Check values before insert[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900