我正在尝试检查一个列的子字符串是否在另一个列中。
FullName
Johns Doue
Johnny
Betty Smith, Chair
表格2
Name
John
使用table2查看它是否是table1的子字符串。它应该返回Johns Doue和Johnny。
SELECT * FROM table1.FullName AS table1
JOIN table2.Name AS table2
WHERE table2.Name LIKE SUBSTRING(table1.FullName, 0, 10);
这里返回的是空值进行比较。我不确定错在哪里。从我的逻辑来看,似乎它正在从table2.name获取结果,并与table1.FullName的子字符串进行比较。