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

```
first off add an index:

```
alter table whatever add key(DOB,LastName,FirstName,StreetAddress);

```

then to see if you the duplicate rows across three of the fields - in this case DOB, FN and LN: 

```
select DOB,LastName,FirstName,StreetAddress from whatever t1 
inner join (
 select DOB,LastName,FirstName,StreetAddress from whatever 
group by DOB,LastName,FirstName,StreetAddress ) as t2 
on t1.DOB=t2.DOB 
and t1.LastName=t2.LastName
and t1.FirstName=t2.FirstName
where t1.StreetAddress != t2.StreetAddress;

```

to look for other combinations, change thefields you join on and the fields in the where clause..