Re: [SQL] ordering by date for each ID

2011-05-12 Thread Samuel Gendler
On Thu, May 12, 2011 at 1:45 PM, Thomas Kellerer wrote: > Nguyen,Diep T wrote on 12.05.2011 03:59: > >> >> Any help would be appreciated. >> > > SELECT id, > date, > score_count, > row_number() over (partition by id order by date desc) as order_value > FROM your_table > > > Or t

Re: [SQL] ordering by date for each ID

2011-05-12 Thread Thomas Kellerer
Nguyen,Diep T wrote on 12.05.2011 03:59: 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

[SQL] ordering by date for each ID

2011-05-12 Thread Nguyen,Diep T
Hi all, I have this table id | date | score_count +--+- 13 | 1999-09-16 | 4 13 | 2002-06-27 | 4 13 | 2006-10-25 | 4 13 | 2010-05-12 | 4 65 | 2002-07-18 | 3 65 | 2004-08-05 | 3 65 |