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



---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to