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: Please help write a query **Urgent** tks

Re: Please help write a query **Urgent** tks

From: Peter Shankey <shankeyp_at_its.charlestoncounty.org>
Date: Thu, 02 Aug 2001 20:27:52 -0400
Message-ID: <3B69F008.73988B59@its.charlestoncounty.org>

Oracle comes with a method for doing this! I cannot remember the script which must be run but if you start looking in the sql referance manual under alter table add primary key you will find it .

Pete's wrote:

> Try something like the following:
>
> select column_name_with_duplicate_names, count(*)
> from your_table_name
> having count(*) > 1
> group by column_name_with_duplicate_names;
>
> After you get the duplicate names, you then could select the rowid's
> if need be, then delete whatever row you wish.
>
> select column_name_with_duplicate_names,rowid
> from your_table_name
> where column_name_with_duplicat_names in ('NAME1',.......);
>
> HTH,
> EP
>
> "OCP" <mr_ocp_at_yahoo.com> wrote in message news:<F_r97.106$nF6.2620_at_newscontent-01.sprint.ca>...
> > Hi
> > We have a table the contains several duplicate records however each record
> > is with an unique primary key, I need to write a query to see how many
> > records are duplicate, there is a name field which has several duplicate
> > names under separat unique id, so is there a way that I can find out how
> > many such duplicate names exists in the table.
> >
> > Please give me some ideas - this is urgent - appreciate your help
> > Mike
> > mr_ocp_at_yahoo.com

--
Peter Shankey
shankeyp_at_its.charlestoncounty.org

Work:   (843) 202-6849
Pager:  (843) 728-4041
Home:   (843) 559-3237
Received on Thu Aug 02 2001 - 19:27:52 CDT

Original text of this message

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