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

Home -> Community -> Usenet -> c.d.o.misc -> Re: remove duplicates from table --sql question

Re: remove duplicates from table --sql question

From: Chris Colclough <chris.colclough_at_jhuapl.edu.nospam>
Date: Tue, 27 Apr 1999 16:23:07 -0400
Message-ID: <37261CAA.1544FB2C@jhuapl.edu.nospam>


Try:
delete from product a
where rowid<
(select max(rowid)
from product b
where b.product_id = a.product_id);

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 - 15:23:07 CDT

Original text of this message

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