Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: DELETING DUPLICATE ROWS
Shiva K Mantri (CS) wrote:
>
> Hi Everybody,
>
> Can any one tell me how to delete duplicate rows in a table?
>
> 1) the rows are duplicate by primary key.
>
> I need to delete all the rows identical row values
>
> ------Shiva Mantri
delete from table
where (rowid, pkey) in
((select rowid, pkey -- get the set of all records
from table
minus -- subtract the unique records from the set of -- all records select max(rowid), pkey -- max doesn't do anything because these are -- unique records but is needed for groupby
minus -- subtract one row for each of the replicated -- records from the set aboveselect max(rowid), pkey
DataWeb Consulting Services "Web-enabling your databases today" voice:(303) 517-3863 FAX: (303) 422-5107 gkainz_at_rmi.net --------------------------------------------------------------Received on Thu May 29 1997 - 00:00:00 CDT
![]() |
![]() |