Re: Existential quantifier

From: Dag-Erling Smørgrav <des(at)des(dot)no>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Existential quantifier
Date: 2009-10-09 23:54:21
Message-ID: 86vdiop1hu.fsf@ds4.des.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)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)

DES
--
Dag-Erling Smørgrav - des(at)des(dot)no

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2009-10-10 00:26:20 Re: Existential quantifier
Previous Message Dag-Erling Smørgrav 2009-10-09 23:48:27 Re: Existential quantifier