Home > Microsoft | SQL | Work > Stupid Duplicates Die Won’t You

Stupid Duplicates Die Won’t You

So the other day my former team member call me asking for help. She had inserted the same data into a table three or more times and needed to get rid of them. For those of you with duplications and need to delete them here’s a little statement i came up with and gave her.

DELETE FROM TBL_Employees

WHERE     (EmpID IN

                          (SELECT     MAX(EmpID) AS Expr2

                            FROM          TBL_Employees

                            GROUP BY FirstName

                            HAVING      (COUNT > 1)))

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks:0

Listed below are links to weblogs that reference
Stupid Duplicates Die Won’t You from Just A Bunch Of Gogorichie
TOP
Stop SOPA