Re: Selecting exactly one row for each column value

From: Florian Weimer <fweimer(at)bfk(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Selecting exactly one row for each column value
Date: 2007-03-06 15:46:29
Message-ID: 82tzwy2x4a.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Tom Lane:

> Florian Weimer <fweimer(at)bfk(dot)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(at)bfk(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-03-06 15:52:58 Re: [Fwd: View Vs. Table]
Previous Message Rodrigo De León 2007-03-06 15:39:25 Re: [SQL] Time of executed query