Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting Duplicates ???
Richard,
Try using the group by function "having". For example, to find all of the duplicate names in a table, I would use a query such as this.
select name, count(*)
from name_table
group by name
having count(*) > 1;
Try this out. It should be what you are looking for.
Frank Redeman
Richard Elliott wrote in message <370D5BF7.E5722B0A_at_flash.net>...
>I thought I had a simple request the other day, turned out I couldn't do
>it with a select, had to write a small pl/sql block. I needed to select
>a list of duplicates in a single table. I thought "minus" would do it
>but not so ! I looked in every source of SQL/Oracle documentation I have
>( a lot !) and no mention of how to identify duplicates. I know the key
>of a table can be used to keep duplicates from existing but these are
>duplicates based on other columns.
>Anybody have the answer ? I like to solve these request with SQL selects
>if possible because I can give the SQL to the user and he can run it
>himself using ODBC if he needs to later.
>
>
Received on Mon Apr 12 1999 - 14:26:10 CDT