Click here to Skip to main content
16,022,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have SQL table in which lakhs of customer data is there like custid,name,dob,mob, etc. I want to identify similar customer name with different custid. Criteria is name , dob and 50% name shall be matched.

example Hemil Gandhi & Gandhi Hemil shall be identified by system.

What I have tried:

SELECT customer_id, name, dob, mobile_number
FROM customer_details
WHERE (dob, mobile_number, name) IN (
    SELECT dob, mobile_number, name
    FROM customer_details
    GROUP BY dob, mobile_number, name
    HAVING COUNT(*) > 1
)
ORDER BY dob, mobile_number, name;
Posted
Comments
0x01AA 16-Jun-24 11:34am    
SFSG, but why do you think your sql statement does make a relation between 'Hemil Gandhi' and 'Gandhi Hemil'?
kmoorevs 17-Jun-24 14:43pm    
Do you control this table? You could make things much easier by splitting the name into two or more columns.

1 solution

Sounds like you have a fair amount of reading to do. Start here, and branch out with Google: sql fuzzy matches tutorial - Google Search[^] - but don't expect this to be simple!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900