Hello.
I have a database with movies similar with imdb and i want to find out which directors have directed both thriller and drama movies.
The output i want is like this "DIR_NAME,amoun t of thriller movies,amout of drama movies"
First i did a check to see the expected number.Checkin only directors that have made thriller movies with
I found 3600 results and max count per director 36,Doing the same with keyword drama i found 19000 results and max count per director 200.So results must be 3600 or less and max count 200.
I use this query for finding out directors taht have made thriller and drama movies
The directors results seems good but the count is for sure wrong.I get the same count for each row count(t1.GENRE) = count(t2.GENRE) and very big amounts that can't be true 1000 thriller movies directed by one director etc which is fault.
Any clue?
I have a database with movies similar with imdb and i want to find out which directors have directed both thriller and drama movies.
The output i want is like this "DIR_NAME,amoun t of thriller movies,amout of drama movies"
First i did a check to see the expected number.Checkin only directors that have made thriller movies with
Code:
select DIR_NAME, count(GENRE) from MGENRES, DIRECTORS, DIRECTED_BY where GENRE = 'Thriller' and MGENRES.MOVIE_ID = DIRECTED_BY.MOVIE_ID and DIRECTED_BY.DIR_ID = DIRECTORS.DIR_ID group by DIR_NAME order by count(GENRE) desc
I use this query for finding out directors taht have made thriller and drama movies
Code:
select DIR_NAME, count(t1.GENRE) as Thriller, count(t2.GENRE) as Drama from MGENRES as t1, MGENRES as t2, DIRECTORS, DIRECTED_BY as t3, DIRECTED_BY as t4 where t1.GENRE = 'Thriller' and t1.MOVIE_ID = t3.MOVIE_ID and t3.DIR_ID = DIRECTORS.DIR_ID and t2.GENRE = 'Drama' and t2.MOVIE_ID = t4.MOVIE_ID and t4.DIR_ID = t3.DIR_ID group by DIR_NAME order by count(t1.GENRE) desc
Any clue?
Comment