On Thu, May 12, 2011 at 1:45 PM, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:
> Nguyen,Diep T wrote on 12.05.2011 03:59:
>> Any help would be appreciated.
> SELECT id,
> row_number() over (partition by id order by date desc) as order_value
> FROM your_table
Or the more general answer to your question is this:
There's lots of neat things you can do with window functions.
In response to
pgsql-sql by date
|Next:||From: R. Smith||Date: 2011-05-13 15:00:16|
|Subject: Sorting data based fields in two linked tables|
|Previous:||From: Thomas Kellerer||Date: 2011-05-12 20:45:21|
|Subject: Re: ordering by date for each ID|