Re: delete duplicates, how?

From: Michael Krall <mkrall_at_ma.ultranet.com>
Date: Thu, 11 Feb 1999 20:12:07 -0500
Message-ID: <79vv71$vaf$1_at_ligarius.ultra.net>


[Quoted] Rune Lysbakken wrote in message <36c28c6b.388959_at_news.online.no>...
>I want to create an unique index but I have some duplicate values. I
>think I can find them with a combination of count, group and having
>Count ()> 1 but how can I delete so that only one of the duplicates
>remains? Use rowid perhaps?
>
>regds Rune
Rune,
Try something along the lines of :

delete from <tablename> a
 where rowid > (select min(rowid)
 from <tablename> b
 where a.<fieldname>=b.<fieldname>);

Hope this helps.
Michael Krall
Senior Systems Engineer
Safety 1st Received on Fri Feb 12 1999 - 02:12:07 CET

Original text of this message