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: SQL Query - Selecting records that repeat / occur more than once in a table -- newbe question

Re: SQL Query - Selecting records that repeat / occur more than once in a table -- newbe question

From: Anurag Varma <avdbi_at_hotmail.com>
Date: Thu, 12 Feb 2004 04:12:28 GMT
Message-ID: <M2DWb.12126$um1.9020@twister.nyroc.rr.com>

"Nimesh" <nbsj67_at_yahoo.com> wrote in message news:ec54ea9f.0402111807.477c1edd_at_posting.google.com...
> I need to find customer's names that repeat / occur more than once in
> the same table. I have treid many options and I have tried comparing
> the column to itself but Oracle gives me an error.
>
> SELECT a.customer_name, b.customer_name
> FROM dtb_customer a, dtb_customer b
> where a.dtb_customer = b.dtb_customer
> and b.customer > 1
>
>
> Any help would be appreciated.
>
> Thanks in advance.

If Oracle is giving you an error .. then its best to keep it with yourself. Don't tell us what it is .. or else we might help you.

Maybe this is what you want?

select customer_name, count(*)
from customer_table
group by customer_name
having count(*) > 1
/

Anurag Received on Wed Feb 11 2004 - 22:12:28 CST

Original text of this message

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