In MySQL I\'m trying to select any row that matches at least 2 fields of the provided data
Eg. I have been given firstName, lastName, dob, website, email and I want
You could count up the matching expressions. MySQL returns 1 for true and 0 for false.
WHERE (FirstName = ?) + (LastName = ?) + (... = ?) > 2
You can also order using this as well. You will want to sort descending to ensure that the higher matches appear first.
ORDER BY ((FirstName = ?) + (LastName = ?) + (... = ?)) DESC