How to get nᵗʰ highest value using plain SQL

前端 未结 8 1163
孤城傲影
孤城傲影 2021-01-24 23:42

What is the simplest way to get the nth highest value from a result set using plain SQL?

The result set would be huge, thus need to consider performance too.

8条回答
  •  自闭症患者
    2021-01-25 00:08

    In a general database, you can do this with a subquery and two order bys. The problem is that top/limit/rownum syntax is not standard. In some databases you would write:

提交回复
热议问题