I have a table of songs, I have another table of tags and a last table with the relationship between the songs and the tags.
I need to get all the songs that contain the tagID of one or more tags, but it should return only one result per song, without duplicates.
Following the attached photos, I would need to obtain record 590 because it meets the condition of having labels 4 and 7. And not receive two records of 590, only one.
I have tried this query but it returns multiple records. And when I change OR to AND it doesn't return anything because I'm comparing the same column. Any solution?
SELECT * FROM tracks_tags WHERE tagId LIKE "%4%" OR tagId LIKE "%7%"
I leave an example of my tables.
TRACK TABLE
TAG TABLE