SQL: Eliminate duplicates in table

Associate
Joined
28 Nov 2002
Posts
766
Location
Down the road
I have a large table containing some duplicate rows (but each row has a unique ID) where all columns are identical between duplicates but for the unique ID. I want to filter out the duplicates (not just the duplicate rows, but the both rows when they are duplicated).

So, for example if I had:

ID Name Address TelNo DOB height weight
2 Joe 123 123 01-Jan-2000 82 80
3 Mary 666 666 21-Feb-1982 66 60
4 Mary 666 666 21-Feb-1982 66 60
5 Bob 010 010 05-May-1974 74 70

I want to eliminate both of the center rows, leaving only the non-duplicates

I’ve been able to group by the common fields which is selecting the data

Mary 666 666 21-Feb-1982 66 60

With a count of two, but how then can I get (and isolate) their ID’s to filter them out? I'm guessing I need some form of inner join on the same table, but can’t fathom it out, despite it being relatively simple (Its Friday!)

Thanks for any tips
 
I cannot do that, unfortunately. This needs to all take place within a single select statement as It is being used as part of a view to transform the data :(
 
Back
Top Bottom