On 8 Aug 2014, at 7:59pm, Simon Slavin <slav...@bigfraud.org> wrote:

> SELECT leadActor.name, movie.title FROM casting
> JOIN actor AS leadActor ON leadActor.id = casting.actorid
> JOIN movie ON movie.id = casting.movieid
> JOIN actor AS selectedActor ON selectedActor.id = casting.actorid
> WHERE casting.ord = 1 AND selectedActor.name = 'Julie Andrews'

Apologies.  This does not actually do what you want.  Your main table should 
actually be movie for this one.  JOIN once to find the leadActor, and JOIN 
again to make sure that Julie Andrews is in it.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to