ordering by date for each ID - Mailing list pgsql-sql

From Nguyen,Diep T
Subject ordering by date for each ID
Date
Msg-id AC6F23A2BA13C347A59BDCBCFF41E27B6954E47BAC@UFEXCH-MBXCL03.ad.ufl.edu
Whole thread Raw
Responses Re: ordering by date for each ID  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-sql
Hi all,
I have this tableid |           date | score_count
----+--------------+-------------13 | 1999-09-16   |           413 | 2002-06-27   |           413 | 2006-10-25   |
    413 | 2010-05-12   |           465 | 2002-07-18   |           365 | 2004-08-05   |           365 | 2007-08-15   |
       386 | 2001-05-29   |           586 | 2002-04-04   |           586 | 2006-03-02   |           586 | 2008-02-13
|          586 | 2011-01-19   |           5 

Each ID can have different number of score counts.

My goal is to add column "order", which shows the order of the values
in column "date" in descendant order for each property. The expected output
will look like this:
id |       date           | score_count | order
----+------------------+---------------+-----------13 | 1999-09-16   |           4        | 413 | 2002-06-27   |
  4        | 313 | 2006-10-25   |           4        | 213 | 2010-05-12   |           4        | 165 | 2002-07-18   |
       3        | 365 | 2004-08-05   |           3        | 265 | 2007-08-15   |           3        | 186 | 2001-05-29
|           5        | 586 | 2002-04-04   |           5        | 486 | 2006-03-02   |           5        | 386 |
2008-02-13  |           5        | 2 86 | 2011-01-19   |           5        | 1 

Any help would be appreciated.

Thanks,

Diep

pgsql-sql by date:

Previous
From: Lew
Date:
Subject: Re: replace " with nothing
Next
From: Thomas Kellerer
Date:
Subject: Re: ordering by date for each ID