MySQL, return only rows where there are duplicates among two columns.
Posted
by Richard Waite
on Stack Overflow
See other posts from Stack Overflow
or by Richard Waite
Published on 2010-03-08T15:13:20Z
Indexed on
2010/03/08
15:21 UTC
Read the original article
Hit count: 208
I have a table in MySQL of contact information ;
first name, last name, address, etc.
I would like to run a query on this table that will return only rows with first and last name combinations which appear in the table more than once.
I do not want to group the "duplicates" (which may only be duplicates of the first and last name, but not other information like address or birthdate) -
I want to return all the "duplicate" rows so I can look over the results and determine if they are dupes or not. This seemed like it would be a simple thing to do, but it has not been.
Every solution I can find either groups the dupes and gives me a count only (which is not useful for what I need to do with the results) or doesn't work at all.
Is this kind of logic even possible in a query ? Should I try and do this in Python or something?
© Stack Overflow or respective owner