简体   繁体   中英

SQL fuzzy match query

I have a uaserData table with users infromation. It has Id , firstname , lastname and many more. So in that table if I have 'like below' two persons with the firstname and lastname are the same they are most likely duplicates. (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.

there are bunch af similar questions answered as example:SQL Fuzzy Matching

this is as SOUNDEX example


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)


在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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