我写了这个,但它只返回完全匹配,例如'Carburetor'而不是'Brand X Carburetor' 任何帮助将不胜感激!
SELECT [Col]
FROM a
WHERE ([Col]) IN
( SELECT [col]
FROM B
)
UNION ALL
SELECT Distinct [col]
FROM B
WHERE ([col]) IN
(
Select [col]
FROM A
)
答案 0 :(得分:1)
使用SQL Server,您可以尝试以下操作。
SELECT a.[Col]
FROM a
INNER JOIN b ON a.Col LIKE '%' + b.Col + '%'
UNION ALL
SELECT Distinct b.[col]
FROM b
INNER JOIN a ON b.COL LIKE '%' + a.Col + '%'