Implementing a total order ranking in PostgreSQL 8.3

后端 未结 3 973
既然无缘
既然无缘 2021-01-28 12:24

The issue with 8.3 is.....rank is introduced in 8.4.

consider the numbers [10,6,6,2]

I wish to achieve a rank of those numbers where the rank is equal to the th

3条回答
  •  离开以前
    2021-01-28 12:45

    Do you have a PK for this table?

    Just self join and count items with: a higher or equal score and higher PK.

    PK comparison will break ties and give you desired result.

    And after you upgrade to 9.1 - use row_number().

提交回复
热议问题