Question: I am trying to find potential duplicate records. For example. 
Where 

* FirstName = FirstName
* LastName = LastName
* DOB = DOB
* Street Address = Street Address

So FirstName, LastName, and DOB are all the same. Or FirstName, LastName, and StreetAddress. Or LastName, DOB, and SteetAddress. And so on......

My client wants the records where 3 out of the 4 values are the same. 
Can this be done in MySql? Or do I need to do some processing in PHP?

Answer: 
Just use SELECT DISTINCT:

```
SELECT DISTINCT first, last, dob, street
FROM Your_Table

```
customer(id, firstname, dob)

To retrieve the customer ids that have same firstname:

```
select id
from customer
where firstname in (select firstname
             from customer
             group by firstname
             having count(*)>1);

```

Or else you'll have to join the table upon itself:

```
select a.id
from customer a, customer b
where (a.firstname=b.firstname and a.lastname=b.lastname and a.dob=b.dob) or 
        (a.firstname=b.firstname and a.lastname=b.lastname and a.address=b.address) or
        (a.firstname=b.firstname and a.dob=b.dob and a.address=b.address) or
        (a.lastname=b.lastname and a.dob=b.dob and a.address=b.address);

```