how to find duplicated rows in a table

  • jjradha

    SSChasing Mays

    Points: 600

    Comments posted to this topic are about the item how to find duplicated rows in a table

  • adnan.korkmaz

    Old Hand

    Points: 388

    edit: this should be one of the most basic queries ever. so, i have been surprised why you have choosen to add an identity column and querying the table twice with joins, etc.

    shouldn't the script below suit your needs?

    select y,x

    from t1 (NOLOCK)

    group by y, x

    having count(1) > 1

  • iskarta

    SSC Enthusiast

    Points: 139

    Infact, I didin't understand why you wrote like that code.

    Where is the difference from below code.

    I think It's very easy.

    SELECT * FROM t1 WHERE y IN (

    SELECT y FROM t1

    GROUP BY y

    HAVING COUNT(y)>1

    )

    Thanks.

  • ABHILASH DHONGDI

    SSC Veteran

    Points: 248

    this has gotta be the most pathetic script i've ever seen...

    I'm surprised SSC even published this!!

  • Maysarah

    Right there with Babe

    Points: 763

    WHY???

    you can use the following

    [font="Courier New"]SELECT

    x,

    y,

    COUNT(y) AS How_Many_Times

    FROM t1

    GROUP BY x, y

    HAVING (COUNT(y) > 1)[/font]

    I don't understand 1.why do you have to add a rowid!! 2.what is the purpose of adding a third column (z) with a default value of zero!!!

  • Sam-263310

    SSC Eights!

    Points: 957

    ABHILASH DHONGDI (6/18/2008)


    this has gotta be the most pathetic script i've ever seen...

    I'm surprised SSC even published this!!

    My thoughts, exactly. You can pick any line in the article and find problems with it. Awful.

  • Yorgs Neil

    SSC-Addicted

    Points: 439

    I would have to agree with the other posts...

    this script stinks on ice.

    How does this warrant a hyperlink to the "solution script".

    Lets keep the quality of the site high....

    Fortunately, it usually is

    :sick:

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply