Home > database >  A list of fuzzy matching a column of data
A list of fuzzy matching a column of data

Time:09-23

Table A: user_id add_info
100 Beijing haidian district, what what what what street community
101 Shanghai changning district what what what what street community
102 in changsha city, hubei province zhenba what village number several
103 in changsha zhenping county of hubei province what village number several


B: table name
Zhenba
Zhenping county



Results: user_id add_info
102 in changsha city, hubei province zhenba what village number several
103 in changsha zhenping county of hubei province what village number several

Add_info contains the content in the name of out


For a great god

CodePudding user response:

Top up, a great god answers

CodePudding user response:

 SELECT * FROM A WHERE the EXISTS (SELECT 1 FROM B WHERE A.a dd_info LIKE '%' + B.a dd_info + '%') 

CodePudding user response:

Or with the following two function
E.g.
 SELECT * FROM A WHERE the EXISTS (SELECT 1 FROM B WHERE PATINDEX (' % '+ B.a dd_info +' % ', A.a dd_info) & gt; 0) 
SELECT * FROM A WHERE the EXISTS (SELECT 1 FROM B WHERE CHARINDEX (B.a dd_info, A.a dd_info) & gt; 0)
  • Related