SELECT duplicates in a table - Mailing list pgsql-general

From Kall, Bruce A.
Subject SELECT duplicates in a table
Date
Msg-id 41A223CD.6040709@mayo.edu
Whole thread Raw
Responses Re: SELECT duplicates in a table
Re: SELECT duplicates in a table
List pgsql-general
I've look for a solution to this, but have only been able to find
solutions to delete duplicate entries in a table by deleting entries not
returned by SELECT DISTINCT.

What sql should I use to SELECT entries in a table that have two
particular column values that match?

For example, my_table has
name, phone number, identification_number, zip code, date of birth, and city

I want to SELECT rows from this table that have the same values in
identification and date of birth (duplicates) so I can have the user
look at them in order to figure out which one to delete.

I tried something like:

  $db_sql = "SELECT * FROM my_table GROUP BY identification_number
HAVING count(date_of_birth) > 1 ORDER BY name"

but that doesn't seem to work.

Thanks,
Bruce


pgsql-general by date:

Previous
From: Scott Nixon
Date:
Subject: Re: Help with syntax for timestamp addition
Next
From: vhikida@inreach.com
Date:
Subject: Re: SELECT duplicates in a table