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: removing duplcates --sql question

Re: removing duplcates --sql question

From: Marc Mazerolle <informaze_at_sympatico.ca>
Date: Tue, 27 Apr 1999 19:16:46 GMT
Message-ID: <37260E41.8BA05531@sympatico.ca>


. Create a non-unique index on product_id . Find duplicate
select product_id from product p1
where exists
 (select 1 from product p2
   where p1.product_id = p2.product_id
     and p1.rowid != p2.rowid)

. Decide what to do with duplicates
. Drop non-unique index
. Create primary key.

Regards,

Marc Mazerolle
InforMaze Technologies

David Spaisman wrote:

> Hello:
>
> I have a basic sql question.
> I have a table --product-- where there are duplicates based upon the
> product_id which was a key but was dropped(inmcreating athe table) and now
> I need to create a pk based upon it but can't until I remove the
> duplicates.
>
> Can someone advise me how to code the delete from this table so that I can
> remove the duplicate product_ids?
>
> Thanks.
>
> David Spaisman
Received on Tue Apr 27 1999 - 14:16:46 CDT

Original text of this message

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