Getting the ranks of results from a query

Поиск
Список
Период
Сортировка
От abhi
Тема Getting the ranks of results from a query
Дата
Msg-id 74D2329E-83F6-11D8-A142-000A95DA7BB2@mit.edu
обсуждение исходный текст
Ответы Re: Getting the ranks of results from a query
Список pgsql-sql
I have a query of the form
select id from member order by age;

id
----- 431  93 202 467 300

In addition to the id, I would like the get the rank of the row--
in other words:
 id  | rank
-----+----------- 431 | 1  93 | 2 202 | 3 467 | 4 300 | 5


How do I do this with postgres?  In the past, I have used something like

select id, identity(int, 1,1) from member order by age;


is there a postgres equivalent?


Thanks



В списке pgsql-sql по дате отправления:

Предыдущее
От: "malia, sean"
Дата:
Сообщение: Re: DB question - Merging data from one table to another.
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Function To Log Changes