The query is to select all records from CompanyListings where at least one of the zip codes in the CompanyZip column occurs once in the ZipCodes column in the CityToZipCodes table. Both the ZipCodes and CompanyZip columns are TEXT data types and all values will always be a comma separated list of numbers.
CityToZipCodes
+----+---------+-----------------------------------+
| ID | City | ZipCodes -
+----+---------+-----------------------------------+
| 1 | Atlanta | 30028, 30040, 30041, 30107, 30151 -
+----+---------+-----------------------------------+
CompanyListings
+-----+-------------------+----------------------+
| ID | CompanyName | CompanyZip -
+-----+-------------------+----------------------+
| 11 | BBB HVAC Company | 30028, 30188, 30107 -
| 12 | Americool | 30520, 30151, 30041 -
+-----+-------------------+----------------------+
I have tried a few queries using LIKE and IN based on other SO questions but they do not work when both table column values are comma separated lists.
SELECT *
FROM CompanyListings
WHERE CompanyZip IN (SELECT ZipCodes
FROM CityToZipCodes
WHERE City = "Atlanta");