SELECT l.`s_slug`
FROM test.`oc_t_city` l
WHERE l.s_slug not IN (SELECT p.asciiname
FROM hello.`geoname` p
WHERE `feature code` not in ('ADM1', 'ADM1H', 'ADM2', 'ADM2H', 'ADM3', 'ADM3H', 'ADM4', 'ADM4H', 'ADM5', 'ADMD', 'ADMDH', 'PCLI'))
How to add LIKE OR statement before second select?
WHERE l.s_slug like '%nested select resutls%' or l.s_slug like 'nested select resutls%' etc.???
I need to fetch all results from both tables then somehow compare them for match using LIKE?
You just add it as a condition on the outer select
NOTE: ‘%search value%’ will automaticaly contain ‘search value%’ so there’s no need to include it twice.
SELECT l.`s_slug`
FROM test.`oc_t_city` l
WHERE l.slug LIKE '%nested select results%'
AND l.s_slug not IN (SELECT p.asciiname
FROM hello.`geoname` p
WHERE `feature code` NOT IN ('ADM1', 'ADM1H', 'ADM2', 'ADM2H', 'ADM3', 'ADM3H', 'ADM4', 'ADM4H', 'ADM5', 'ADMD', 'ADMDH', 'PCLI'))