Skip to content

Question: Rank ordered by multiple columns executed by the server? #5265

Closed as not planned
@Villason

Description

@Villason

Hi,

How can I implement the RANK() function taking into account two columns for the ranking? The main column does not have unique values. This is the query:

select *, RANK() over (order by score, posteddate desc) as rank from Post

I need to implement pagination without the offset limit pattern and I thought a kind of ranking function would be ok. I have a partial implementation which only works with uniques, using the '>' or '<' operands on the key used for pagination.

Any idea? I cannot find a solution online.

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions