From: Tom Lane <tgl@sss.pgh.pa.us>
To: Florian Weimer <fweimer@bfk.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Selecting exactly one row for each column value
Date: Tue, 06 Mar 2007 10:32:35 -0500
Message-ID: <4736.1173195155@sss.pgh.pa.us> (raw)
In-Reply-To: <82hcsy4do7.fsf@mid.bfk.de>
References: <82hcsy4do7.fsf@mid.bfk.de>
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.
regards, tom lane
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: tgl@sss.pgh.pa.us, fweimer@bfk.de
Subject: Re: Selecting exactly one row for each column value
In-Reply-To: <4736.1173195155@sss.pgh.pa.us>
* 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