Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

Please tell me how to delete a duplicate row in a table?
Posted
Comments
Uday P.Singh 21-Jul-11 15:23pm    
your question is not clear, give table structure and what do you want?
Member 7920084 21-Jul-11 16:35pm    
I have created a table and entered some duplicate rows into that table. Now I want to find out duplicate rows and delete them..

 
Share this answer
 
v2
SQL
DELETE FROM Table1 WHERE Col1 NOT IN (SELECT MIN(Col1) FROM Table1 GROUP BY DupCol1, DupCol2, DupCol3)
 
Share this answer
 
Comments
[no name] 22-Jul-11 0:41am    
Wondering why my answer was downvoted!!!
I'm on my phone now so can't help properly, but check out sqlservercentral.com. I remember someone asking that question there and it was resolved =D
 
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