Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting Duplicates ???

Re: Selecting Duplicates ???

From: Frank Redeman <fredema1_at_rr.san.com>
Date: Mon, 12 Apr 1999 12:26:10 -0700
Message-ID: <RWNR2.698$6B.36499@news.san.rr.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US