Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie Urgent ? - How to remove duplicate records
Hi Brian,
Try something along the following lines (I know this will work because it was submitted by Thomas Kyte):
delete from mytable
where rowid <> ( select max(rowid)
from mytable B where b.col1 = mytable.col1 and b.col2 = mytable.col2 .... );
regards
Jerry
Brian Richardson wrote in message
<36139327.49C8A1E4_at_kscgws00.ksc.nasa.gov>...
>Hello,
>
>A colleague has encountered the following scenario. Any suggested
>assistance would be greatly appreciated, since we have users waiting.
>
>Environment : Oracle 7.3.x, Sun Solaris OS, Netscape clients (PC),
>PL/SQL
>
>Scenario : From within SQL>, inadvertently imported data twice
>resulting
> in duplicate entries for each item in every table.
>Several other
> commands have been performed since then (including
>a COMMIT).
>
>Question : Would like to elimnate the duplicate entries only, and
>get the tables
> back into their original condition.
>
>Any suggestions/assistance would be greatly appreciated, and if I have
>not provided
>enough information for someone to respond, please let me know and I will
>provide
>additional details in a follow-up posting.
>
>Brian Richardson
>
Received on Fri Oct 02 1998 - 12:54:29 CDT