Re: oracle's first_value function for postgres?

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Ben <bench(at)silentmedia(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: oracle's first_value function for postgres?
Date: 2005-09-13 20:32:51
Message-ID: 20050913203250.GL6026@ns.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

* Ben (bench(at)silentmedia(dot)com) wrote:
> Oracle has a very handy function called first_value, which can be used
> to turn a set like this:
>
> a 10
> a 3
> b 1
> c 30
> c 10
> d 1
> d 20
>
> ...into this:
>
> a 10
> b 1
> c 30
> d 1
>
> Does postgres have something equivalent, or, even better, is there a
> reasonable way to express this in standard SQL?

Isn't this just: distinct on (col1)?

Stephen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-09-13 20:34:40 Re: oracle's first_value function for postgres?
Previous Message Craig 2005-09-13 20:07:45 Ranking Results