sql - Is it possible to make the group by clause to make groups with small variations? -




i attempting write query finds when name changes customer id not. used

group custid, name 

then counted customer ids, result greater 1 important. here query have far:

select     custid,     numdiffnames     (select         custid,         count(custid) numdiffnames             (select             custid,             name                     (select                 custid,                 concat(rtrim(ltrim(firstname)),rtrim(ltrim(lastname))) name                             [branch]             union             select                 cocustid custid,                 concat(rtrim(ltrim(cofname)),rtrim(ltrim(colname))) name                             [branch])         group custid, name) b     group custid) c numdiffnames>1 

however, getting many false positives. removed large number of them trimming whitespace around each name. set of false positives formed data entry , misspellings. example in 1 case customers name spelled vanessa, , same customer id, name spelled venessa. or name spelled correctly in 1 case, 2 letters transposed in john & jhon example.

is possible have groups more variance, 1 or 2 character differences?

could use this?

with cte (     select distinct          custid         ,[name]         ,row_number() on (partition custid, [name] order custid) rownumber     branch )  select *  cte  rownumber > 1 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -