pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dag-Erling Smørgrav <des@des.no>
To: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Existential quantifier
Date: Sat, 10 Oct 2009 01:54:21 +0200
Message-ID: <86vdiop1hu.fsf@ds4.des.no> (raw)
In-Reply-To: <20091009160318.J80119@megazone.bigpanda.com>
References: <86bpkgqiv8.fsf@ds4.des.no>
	<20091009160318.J80119@megazone.bigpanda.com>

Stephan Szabo <sszabo@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)

DES
-- 
Dag-Erling Smørgrav - des@des.no



view thread (6+ messages)  latest in thread

Message-ID: <86vdiop1hu.fsf@ds4.des.no>
Permalink:  ../86vdiop1hu.fsf@ds4.des.no/
Also on:    postgresql.org/message-id/86vdiop1hu.fsf@ds4.des.no

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: des@des.no, sszabo@megazone.bigpanda.com
  Subject: Re: Existential quantifier
  In-Reply-To: <86vdiop1hu.fsf@ds4.des.no>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox