question

kandanDevi avatar image
kandanDevi asked

Fuzzy Look Up or any other solution for partial match

Hi All, Please suggests me on the below scenario to find the solution. I have 2 Tables: Table 1: ![alt text][1] Table 2: ![alt text][2] I want to lookup (find the match) table 2 with table 1 and find the **Amount** based name and part number matches. Thanks, Kandan.M [1]: /storage/temp/3088-1.png [2]: /storage/temp/3089-2.png
sqlssisssmsexceltables
1.png (17.8 KiB)
2.png (10.0 KiB)
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Gazz avatar image
Gazz answered
You should be able to CROSS JOIN the two tables and in the WHERE part have table2.PartNumber like '%' + table1.PartNumber +'%' AND table1.Name = table2.Name I haven't tried this, but hopefully something like this will work: SELECT t1.Name,t1.PartNumber,SUM(AMOUNT)[SumAmount] FROM table1 t1 CROSS JOIN table2 t2 WHERE table2.PartNumber like '%' + table1.PartNumber +'%' AND table1.Name = table2.Name GROUP BY t1.Name,t1.PartNumber
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.