Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL problem
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
![]() |
![]() |