Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: removing duplcates --sql question
. 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