我有一个只包含“name”列的数据库。它有以下条目:
boyleston112, boylstonLLC, boylstnLLC
Amendment12, Amend12, Amendmnt
另外,我在同一个表中有不同的条目。 我希望列出这样的外观条目。我应该写什么查询? 我使用过自联接,但仍然有许多未涵盖的条目..代码如下:
SELECT *
FROM #QA_filter QA1
INNER JOIN #QA_filter QA2 ON QA1.name like QA2.name + '%' and QA1.Name<> QA2.Name
请帮忙!
答案 0 :(得分:1)
可能是这样的吗?
SELECT group_concat(actual),left(snd,3)
FROM
(
select soundex('boyleston112') as 'snd','boyleston112' as 'actual'
UNION
select soundex('boylstonLLC') as 'snd','boylstonLLC' as 'actual'
UNION
select soundex('boylstnLLC') as 'snd','boylstnLLC' as 'actual'
UNION
select soundex('Amendment12') as 'snd','Amendment12' as 'actual'
UNION
select soundex('Amend12') as 'snd','Amend12' as 'actual'
UNION
select soundex('Amendmnt') as 'snd','Amendmnt' as 'actual'
)tmp
group by left(snd,3)
答案 1 :(得分:0)