Results 1 to 3 of 3

Thread: [RESOLVED] Finding duplicate values in a DB Table?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Resolved [RESOLVED] Finding duplicate values in a DB Table?

    I always forget how to do this but I'm trying to write a SQL query that identifies a specific column per row that has duplicate values. In other words, there may be 5 rows where the LastName has the same value. How do I write a query that will return only those rows?

    Thanks,
    Blake

  2. #2
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Finding duplicate values in a DB Table?

    Something like this:
    Code:
    Select LastName,Count(*) From tablename Group BY LastName Having Count(*) > 1
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: Finding duplicate values in a DB Table?

    Thanks Gary...that's what I was lookin' for!
    Blake

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width