I have a comma delimited list like this saved in a mysql table:
-----------------
|id | list |
-----------------
| 4 |12,45,65,4 |
Each number in “list” corresponds with an ID in another table.
Is there a way so I can query the other table based on theses IDs and bring up those rows associated with the numbers in “list”?
Not any efficient way with your current schema. The correct and most efficient way to do it is to change the schema to hold multiple rows like this:
Then you use
JOINoperations to connect4to every related row in your other table.This is called database normalization and is a very important topic in database design. Relational database systems are built to handle just this types of problems in an efficient manner.