Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: remove duplicates from table --sql question
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
![]() |
![]() |