user2208495
user2208495

Reputation: 19

What is wrong with my Sub select statement?

When I run this query it produces a result of zero. I know there is supposed to be a result of the longest length movie with that actor, but don't know what I am doing wrong in my sub select. Thoughts?

SELECT film.length,film.title
FROM moviedb.film,moviedb.actor,moviedb.film_actor
WHERE film.film_id = film_actor.film_id
AND film_actor.actor_id = actor.actor_id
AND actor.first_name = "Salma"
AND actor.last_name = "Nolte"
AND film.length = (SELECT MAX(film.length) FROM moviedb.film);

Upvotes: 0

Views: 33

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269753

You are asking for the problem. The problem is that the film that has the maximum length does not meet the other criteria in the where clause. That is simple.

You should learn to use proper explicit join syntax in your queries.

Upvotes: 2

Related Questions