Re: Existential quantifier

From: Dag-Erling Smørgrav <des(at)des(dot)no>
To: Richard Albright <ralbright(at)insiderscore(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Existential quantifier
Date: 2009-10-09 23:48:27
Message-ID: 86zl80p1ro.fsf@ds4.des.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Richard Albright <ralbright(at)insiderscore(dot)com> writes:
> you could use distinct on
>
> select distinct on (fs.film.title, fs.film.year ) title, year
> from fs.film left join fs.star on fs.film.id = fs.star.film
> where fs.star.last = 'Sheen';

Thanks, I didn't know about "distinct on". This version uses the
primary (surrogage) key:

select distinct on (fs.film.id) fs.film.title, fs.film.year
from fs.film left join fs.star on fs.film.id = fs.star.film
where fs.star.last = 'Sheen';

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dag-Erling Smørgrav 2009-10-09 23:54:21 Re: Existential quantifier
Previous Message Richard Albright 2009-10-09 23:11:09 Re: Existential quantifier