您将如何使用“LIKE”在子查询中进行搜索?
例如,我尝试过这样做,但不起作用:
SELECT *
FROM mytable
WHERE name
LIKE '%
(SELECT name FROM myothertable)
%'
到目前为止我有这个:
SELECT * FROM t1
WHERE t1.name IN (SELECT t2.name FROM t2)
AND (t1.title IN (SELECT t2.title FROM t2)
OR t1.surname IN (SELECT t2.surname FROM t2))
它工作正常,因为它返回完全匹配,但它似乎没有返回我的其他类似记录,所以我还想检查一下:
t1.title LIKE '%t2.title%' AND t1.surname LIKE ' %t2.surname%'
我该怎么做?