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: Counting duplicates in SQL

Re: Counting duplicates in SQL

From: Thomas Kellerer <ESPKLFCTEKVY_at_spammotel.com>
Date: Sat, 02 Sep 2006 19:25:05 +0200
Message-ID: <4ltt3hF39vk8U1@individual.net>


DA Morgan wrote on 02.09.2006 18:47:
>>> So for example for "Sausage" I would like to report how many rows
>>> have an ID
>>> of 82785, 83780 and 99999 respectively. I can't see how I can adapt
>>> my statement above. Is there another approach using just SQL?
>>
>> SELECT product_id, count(*)
>> FROM
>> (
>> your statement goes here
>> )
>> WHERE product_name = 'Sausage'
>> GROUP BY product_id
>>
>> Thomas

>
> to which I would add HAVING COUNT(*) > 1

I thought that at first as well, but the OP said "to report how many rows have an ID" which sounds more like he'd like to have the ones with only one row as well.

Thomas Received on Sat Sep 02 2006 - 12:25:05 CDT

Original text of this message

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