Hello, I'm using Access and need to code this query on SQL and I have this problem:
I have 3 tables: Movie, Actor, Acts_In
Movie table has fields: Movie_ID, movie_name, actor_1, actor_2, director
Actor table has fields: Actor_ID, first_name, last_name
Acts_IN table has fields: Movie_ID, Actor_ID
* actor_id and movie_id are primary keys
I have to create a query that allows me to search for a director, giving me a list of actors that have worked with that director, and all the movies they have acted in.
so far I have come up with this code, however:
select actor.first_name, actor.last_name, movie_name
from (actor inner join acts_in ON acts_in.actor_ID=actor.actor_id) inner JOIN movie ON acts_in.movie_ID=movie.movie_id
group by actor.first_name, actor.last_name, movie_name;
This code gives me a list of all actors and all movies they acted in, but it does not give me specific actors in respect to a specific director, adding
where director="XYZ"
does not work as it gives me all actors that have worked with director XYZ but not all movies they have acted in.
Thanks!