I'm making a gif database and I want to store every gif by genre in my database, I'm using 3 tables, genres, gifs and gifs_genres, genres stores all the genres that are in the system, gifs are the actual gifs and their storage location, and gifs_genres stores what gifs have what genres
They look like this:
Genres:
gifs:
gifs_genres:
and I want to be able to search with multiple genres and find only the results with ALL genres
the desired results: (made in exel to showcase)
Filtering for genre 36 (cute)
and If I filter for 38 and 36 (cartoon and cute)
what I'm using right now:
USE gifapi;
SELECT title, file, genre
FROM gifs
RIGHT JOIN gifs_genres ON gifs.id = gifs_genres.gif_id
RIGHT JOIN genres ON gifs_genres.genre_id = genres.id
WHERE gifs_genres.genre_id = 36
I'm not very experienced with SQL so I am unable to figure this out. All I've done with sql before is Select *, and UPDATE
The reason why I want a comma separated value is only to show the user what genre's the gif is, I will not store the table that is created.