简体   繁体   English

SQL模糊匹配查询

[英]SQL fuzzy match query

I have a uaserData table with users infromation.我有一个包含用户信息的uaserData表。 It has Id , firstname , lastname and many more.它有Idfirstnamelastname等等。 So in that table if I have 'like below' two persons with the firstname and lastname are the same they are most likely duplicates.因此,在该表中,如果我有“如下所示”两个firstnamelastname相同的人,他们很可能是重复的。 (can be spelling mistakes) (可能是拼写错误)

Id     1
firstname    "kim"
lastname     "kardashian"

Id     2
firstname    "kem"
lastname     "kardshian"

I know how do this if I were to match exactly on all columns but I need fuzzy match to do.如果我要在所有列上完全匹配,我知道该怎么做,但我需要进行模糊匹配。 There are fuzzy match examples but it very difficult to understand.有模糊匹配的例子,但很难理解。 SOUNDEX also not helping much. SOUNDEX 也没有多大帮助。

there are bunch af similar questions answered as example:SQL Fuzzy Matching有一堆类似的问题作为例子回答:SQL Fuzzy Matching

this is as SOUNDEX example这是作为 SOUNDEX 示例


Declare @t Table (FName varchar(20) ,  LName varchar(20))

insert into @t Values
('kim'    ,'kardashian')
,('kem'     ,'kardashian')
,('klm'     ,'kardashian')

select *
from @t
where SOUNDEX('kam') = SOUNDEX(FName)


在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM