Použití JOIN:
SELECT a.*
FROM mytable a
JOIN myothertable b ON a.name LIKE CONCAT('%', b.name, '%')
...ale mohou existovat duplikáty, pokud je v myothertable
více než jedna shoda pro danou mytable
záznam.
Pomocí EXISTS:
SELECT a.*
FROM mytable a
WHERE EXISTS (SELECT NULL
FROM myothertable b
WHERE a.name LIKE CONCAT('%', b.name, '%'))
Pomocí Fulltext Search MATCH
(vyžaduje myothertable
je MyISAM)
SELECT a.*
FROM mytable a
JOIN myothertable b ON MATCH(a.name) AGAINST (b.name)