sql server - Update column from another table based on matching column value using fuzzy logic -


how update column table on basis of percentage of matching of 2 column of 2 tables

e.g suppose have table company1 having column address1 , companyname1 , table company2 having column address2 , companyname2 .i want update companyname1 of company1 table company2 on basis of address1 , address2 matching percent value. please suggest me efficient running query

based on comment:

;with company2 ( select  'hamby chiropractic' companyname2,         '6716 madison ave # a1' address2 ), company1 ( select  null companyname1,         '6716 madison' address1 )  select *, len(c1.address1)*100.00/len(c2.address2) company1 c1 left join company2 c2     on c2.address2 '%' + c1.address1 +'%'     or c1.address1 '%' + c2.address2 +'%' 

i

companyname1    address1        companyname2        address2                (no column name) null            6716 madison    hamby chiropractic  6716 madison ave # a1   57.1428571428571 

i have counted percent based on length of strings. sufficient enough you?


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -