Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I need to do a fuzzy match with a table that has duplicate company names due to misspelling or different naming conventions, and group the duplicates together by creating an group id for each set of matches. I have found the Jaro-Winkler at http://www.sqlservercentral.com/articles/Fuzzy+Match/65702/, but I am having a hard time figuring out the next step. Is there anyway to grab a row, match it with every other rows in the table, and repeat the process for every row?
malpashaa
Constraint Violating Yak Guru
264 Posts
Posted - 2010-04-14 : 17:59:16
Yes you can and one way to do this is to use APPLYSo try something like this:
SELECT T1.name, T2.name, T2.match FROM SomeTable AS T1 CROSS APPLY (SELECT T2.name, SomeFunction(T1.name, T2.name) AS match FROM SomeTable AS T2) AS T2