From: Dag-Erling Smørgrav <des@des.no>
To: Richard Albright <ralbright@insiderscore.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Existential quantifier
Date: Sat, 10 Oct 2009 01:48:27 +0200
Message-ID: <86zl80p1ro.fsf@ds4.des.no> (raw)
In-Reply-To: <1255129869.11289.4.camel@indie-desktop>
References: <86bpkgqiv8.fsf@ds4.des.no>
<1255129869.11289.4.camel@indie-desktop>
Richard Albright <ralbright@insiderscore.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@des.no
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, ralbright@insiderscore.com
Subject: Re: Existential quantifier
In-Reply-To: <86zl80p1ro.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