0

I want to find all duplicate names from contacts table whose name matches by sound. Eg : Rita or Reeta , Microsoft or Microsift , Mukherjee or Mukherji.

I have used below query :

select contacts.id from contacts INNER JOIN (SELECT first_name,last_name,count(*) as rows FROM contacts where deleted = 0 GROUP BY soundex(first_name),soundex(last_name) HAVING count(rows) > 1) as p where contacts.deleted=0 AND p.first_name sounds like contacts.first_name and p.last_name sounds like contacts.last_name ORDER BY contacts.date_entered DESC

The above query gives right results but takes a lot of time when there are many records.

user3286692
  • 383
  • 1
  • 5
  • 23

0 Answers0