Re: delete duplicate rows
Posted in 1995
Here is another way you can remove the duplicates.
DELETE FROM table_name WHERE ROWID NOT IN
(SELECT MIN(ROWID) FROM TABLE GROUP BY column_name)
------------------------------------------------------------------------
-----
In article <3otanf$7gs@cssun.mathcs.emory.edu>
sheltra@emh-1.submepp.navy.mil writes:
> This procedure was passed on to me by another netter, Ian
> Timms. I used it and found it to be very painless.
>
> Unload the table to a file, delete all rows from the table,
> create a unique index on the fields necessary to ensure that
> the duplicates can not recurr, then reload the table using
> dbload with the -e option to ignore errors from the attempt
> to load duplicate rows. The only problem will be if you are
> not happy with the idea of only getting the first of the
> duplicates loaded (ie. say you wanted the second one
> instead!), unless you can order the unloaded to suit (using
> order by clause on the select) then your almost stuck
> (almost because you could always use an editor to delete the
> dupes before loading<g>).
>
> Good Luck, Reggie
>