Prøv denne forespørgsel:
SELECT m2.movieId
FROM mMoviesGenres m1
INNER JOIN mMoviesGenres m2
ON m1.genreID = m2.genreID
WHERE m1.movieId = 1 AND
m2.movieId <> 1
GROUP BY m2.movieId
HAVING COUNT(*) = (SELECT COUNT(*) FROM mMoviesGenres WHERE movieId = 1)
Opdatering:
Hvis du vil finde film, der ligner hinanden med hensyn til mindst to genrer, så brug denne HAVING
klausul:
HAVING COUNT(*) >= 2