I am writing a query to select the greatest number of total nominations among the movie of genre Comedy. I have the following query so far
SELECT m.movie_title, m.release_year, COUNT(*)
FROM MOVIE m JOIN NOMINATION n
ON (n.movie_title=m.movie_title AND n.release_year=m.release_year)
WHERE m.genre='Comedy' GROUP BY m.movie_title, m.release_year;
If I execute the following query
SELECT m.movie_title, m.release_year
FROM MOVIE m
WHERE (m.genre='Comedy') GROUP BY m.movie_title,m.release_year);
It returns me with 3 results. My motive is to get one result with the highest count of nominations for movies with genre comedy.
Is my logic incorrect? I am still a beginner to sql (oracle11g) and teaching myself.
I have looked at multiple tutorials online but nothing has been able to help so far.
Thank you for all the help.