From: Florian Weimer <fweimer@bfk.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Selecting exactly one row for each column value
Date: Tue, 06 Mar 2007 16:46:29 +0100
Message-ID: <82tzwy2x4a.fsf@mid.bfk.de> (raw)
In-Reply-To: <4736.1173195155@sss.pgh.pa.us>
References: <82hcsy4do7.fsf@mid.bfk.de>
<4736.1173195155@sss.pgh.pa.us>
* Tom Lane:
> Florian Weimer <fweimer@bfk.de> writes:
>> For each value in the first column, I need one (and only one) matching
>> row from the table. A possible solution is:
>
> SELECT DISTINCT ON would do it, if you don't mind a non-portable solution.
Cool, thanks a lot.
--
Florian Weimer <fweimer@bfk.de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
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: fweimer@bfk.de, tgl@sss.pgh.pa.us
Subject: Re: Selecting exactly one row for each column value
In-Reply-To: <82tzwy2x4a.fsf@mid.bfk.de>
* 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