IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New 'Nother question.
Is there an easy way to remove duplicates with SQL? E.g.:

Johnson John 12/24/1963 blah blah blah
Johnson John 12/24/1963 blah blah blah
Schmugenmeyer Froelich 6/5/1948 blah blah blah
Schmugenmeyer Froelich 6/5/1948 blah blah blah
Schmugenmeyer Froelich 6/5/1948 blah blah blah
New Oooh, fun :-)
The simplest and most portable way is to do an insert into an identical table that is the output of a group-by from your original table.

Beyond that, well you get into vendor extensions, custom programming etc.

The problem looks simple, but it is non-trivial exactly because SQL is set-oriented. By its nature, there is no set statement that you can make which actually distinguishes two identical things. So you can easily identify delete all duplicated things. But determining which duplicate to get rid of is another story.

In Access this is a very good reason to add an auto-incrementing ID column. Then you are guaranteed to always have some way to distinguish two rows (the ID column).

Cheers,
Ben
"good ideas and bad code build communities, the other three combinations do not"
- [link|http://archives.real-time.com/pipermail/cocoon-devel/2000-October/003023.html|Stefano Mazzocchi]
New SELECT DISTINCT or a GROUP BY
New In access, I think its Select DistinctRow
bcnu,
Mikem

I don't do third world languages. So no, I don't do Java.
New Make and examine a "Find Duplicates" Query
For example:

SELECT * FROM Telescopes
WHERE (((Telescopes.ID) In (SELECT [ID] FROM [Telescopes] As Tmp GROUP BY [ID] HAVING Count(*)>1 )))
ORDER BY Telescopes.ID;

Then write a VBA script to iterate through the results and delete all but one of each set.
     OpenRecordset in Access. - (acagle) - (13)
         Join the tables and only select from one of them -NT - (ben_tilly) - (6)
             Re: Join the tables and only select from one of them - (acagle)
             Re: Join the tables and only select from one of them - (acagle) - (4)
                 I can't figure that strategy out. - (FuManChu) - (3)
                     I think - (mmoffitt) - (2)
                         Ya, that's it. - (acagle) - (1)
                             Cut and paste is a known killer! :) -NT - (a6l6e6x)
         Bookmarks? - (altmann)
         'Nother question. - (acagle) - (4)
             Oooh, fun :-) - (ben_tilly)
             SELECT DISTINCT or a GROUP BY -NT - (ChrisR) - (1)
                 In access, I think its Select DistinctRow -NT - (mmoffitt)
             Make and examine a "Find Duplicates" Query - (FuManChu)

My head feels like a frisbee.
88 ms