On Sat, 10 Oct 2009, [utf-8] Dag-Erling Sm??rgrav wrote:

> Stephan Szabo <ssz...@megazone.bigpanda.com> writes:
> > Not at all tested as I don't have access to my db right now, but I think
> > something like one of these would work:
> >
> > select fs.film.title, fs.film.year
> >  from fs.film
> >  where exists(select 1 from fs.star where fs.film.id = fs.star.film
> >   and fs.star.last = 'Sheen');
>
> Ah, that was exactly what I was looking for.
>
> > select fs.film.title, fs.film.year
> >  from fs.film
> >  where fs.film.id in (select fs.star.film where fs.star.last = 'Sheen');
>
> ITYM
>
> select fs.film.title, fs.film.year
>  from fs.film
>  where fs.film.id in (
>    select fs.star.film from fs.star where fs.star.last = 'Sheen'
>  );
>
> (missing FROM)

Yeah, that'd be necessary. You might want to try them on a realistic data
set to see how the various options are planned.

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

Reply via email to