I have a database where I store a code which is an implode("|", $array) of various codes. So the results will be something like:
Have you heard of MySQL's
LIKE operator? Something like this might be what you have in mind:
SELECT * FROM yourTable WHERE someCol LIKE '100|%|510;
100|5200|510 as data, this query would return both of these records.