SQL code to select duplicates

Ruslan Zasukhin sunshine at public.kherson.ua
Wed May 5 08:24:13 CDT 2004


On 5/5/04 2:49 AM, "Tim James" <tjames1 at bigpond.net.au> wrote:

> I have a table that has had duplicates (that is rows with a key indexed
> field the same) added to it due to erroneously turning off a unique
> flag.
> 
> Is there some neat/simple way to select all duplicates in one select ?

Hi Tim,

Exists workaround:

    select count(*)
    from T
    GROUP BY f1, f,2 ... fn
    ORDER BY 1

So you will get cursor where first records will have bigger count(*)
Now you can iterate it ntil you meet count(*) == 1


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list