0

I would be so happy if someone could help me with this one. Here is the problem: I have table like this

[Account ID]      |  [Account Name]
-------------------------------------------------
0014600000tgE23   |  Lizzards Pub - Various
0014600000tgE25   |  Lizzards Pub, The - Various
0014600000tgE20   |  Phi Nguyen - Various

I can find duplicates easy, but I can't match "Lizzards Pub - Various" and "Lizzards Pub, The - Various", so question is how can I match similar values. I tried Soundex and Difference but the problem is that I have about 45000 records in this table, and I don't have time to scroll that much.

This is what I have tried

select sfc.[Account Name], sfc.[Account ID]
FROM [Test].[dbo].[report1517492198819$] sfc
join (select left(sfc1.[Account Name], 8) as firstFew, count(*) as brojac
      from [Test].[dbo].[report1517492198819$] sfc1
      group by [Account Name] 
      having COUNT(*)>1) y 
      on sfc.[Account Name] like '%' + y.firstFew + '%' 
      order by sfc.[Account Name]

Thank you all so very much! :D

0 Answers0