Similarity search within customer_code
So basically I have my data which has customercode and their addresses. The problem is that one customer has multiple addresses and I want to count to number of distinct addresses that a customer has. I can’t do GroupBy customercode and then do a unique count in manual aggregation for the addresses because the addresses are the same but framed differently.
So I did a Levenshtein similarity search but it’s taking one address and comparing the distance with all the other addresses. Whereas what I want is the similarity test should only be done on addresses of a single customerid. If I have a customercode 123456 which is listed 4 times with the same address which is just framed differently, I want the similarity search/test to happen within the customer_code 123456 and the first address of 123456 should be searched with all the other addresses of customer 123456 only.
Is there a way to achieve this?