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

From: kibeha <kibeha_at_post6.tele.dk>
Date: 12 Feb 2004 01:49:34 -0800
Message-ID: <444b180d.0402120149.48a902eb_at_posting.google.com>


nbsj67_at_yahoo.com (Nimesh) 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.

Standard way of discovering duplicates would be like this :

select a.customer_name, count(*)
from dtb_customer a
group by a.customer_name
having count(*) > 1

/KiBeHa Received on Thu Feb 12 2004 - 10:49:34 CET

Original text of this message