I have the following “problem”.
Table “labels” include the record labels.
Table “albums” include the albums, and a field with the labels of the album in question, formatted like “1,4,9”.
Now I want to get the label names along with the album name, release year, artist etc. I have everything but the label names figured out! It seems like FIND_IN_SET won’t work with commas… Can you guys please help me, or do I have to use a secondary query for the label names?
Thank you!
The problem is that your schema is wrong. You do not store the relationship between albums and labels as a comma-separated list. Any column’s value should always be atomic (single valued).
The way to store a many-to-many relationship like this is with a new table.
Now retrieving the artist and their label info at the same time is easy.