Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Selecting Duplicates ???
Alternatively You can use co-related subquery
select col1
from table a
where 1 < (select count(*) from table b where a.col1 = b.col1)
Philippe wrote:
> If col1 is the duplicated column:
>
> select col1, count(col1) from YourTable group by col1 having count(col1) > 1
>
> hth
> Philippe
>
> 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 Fri Apr 09 1999 - 04:05:38 CDT
![]() |
![]() |