I’m having some trouble writing the SQL statement for the following request: “Find the actors that acted in the movie and in the remake of that same movie”.
The three tables are ‘films’, ‘remakes’ and ‘casts’:
films attributes: filmid, filmname, year, director
remakes attributes: filmid, title, year, priorfilm, priortitle, prioryear
casts attributes: filmid, filmname, actor
So far I know that the priorfilm attribute should correspond with the filmid of the film being tested so I started with this:
select actor
from casts, remakes, actors
where casts.filmid = remakes.priorfilm
But I have no clue how I should proceed with this.
It was a bit confusing, as you had an ‘actor’ table in your SQL, which was not in the three zyou specified…
Try:
Note that the casts table has to be joined in two times.