Finding Duplicates

  • Hello All,

    I have created a query to find the contact list from a database. However what i found out was that there were a lot of duplicates in the results.

    Example:

    First Name Last Name Phone Company

    Anthony Silva 915-111-2131 Accenture

    Anthony Silva 915-111-2131 Accenture

    Now the result set shows me over 10,000 rows and i was wondering how can i create a query to find out just the ones that are duplicates.

    The data type for all the fields is varchar(50).

    I appreciate all the help!

    Thanks!

  • Without DDL and sample data like you'll find in the first link in my sig, best I can offer is general advice.

    What you'll want to do is generate a query based on your possible duplication columns, use them in a group by, and use a having COUNT(*) > 1 clause on it.

    This will display all dupes.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • chaudharyabhijit

    Now the result set shows me over 10,000 rows and i was wondering how can i create a query to find out just the ones that are duplicates.

    And once these are found what do you desire (need) to do, eliminate the duplicates so that only one entry remains or?

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

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