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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL problem

Re: SQL problem

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Fri, 28 Aug 1998 17:41:45 GMT
Message-ID: <35e6eaa1.10766070@dcsun4.us.oracle.com>


On Fri, 28 Aug 1998 15:25:54 GMT, russ_at_u-net.net (Russell Fray) wrote:

>
>Hi there,
>
>Just a quick question for the SQL gurus, as I can't seem to suss this
>one :)
>
>I have a table which contains lots of numbers in a field called
>'ag_num'. Within this field, some numbers are duplicated. I want to
>list the duplications so i can delete them at my discretion, before
>copying all data from this table in to a new table that does not allow
>duplicated in that field.
>
>In pseudo code :
>
>select * from (table.name) where the same ag_num is repeated more than
>once

try:

select ag_num, count(*)
  from T
having count(*) > 1
 group by ag_num;

This will give you every number that occurs more than once and how many times that particular number does occur.

chris.

>
>Please cc replies to russ_at_u-net.net
>
>Thanks!
>Russ.
Received on Fri Aug 28 1998 - 12:41:45 CDT

Original text of this message

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