How to get second largest or third largest entry from a table

前端 未结 12 2438
说谎
说谎 2020-12-01 08:42

Can anyone please tell me how to find out the N th largest entry from a table in Oracle?

Like for largest we can use MAX(column_name) i

12条回答
  •  有刺的猬
    2020-12-01 09:26

    You can ORDER BY column name and then LIMIT 1,1 to get the second one

    edit

    Whoops, didn't see the Oracle tag, sorry.
    ORDER BY column name WHERE ROWNUM = 2 should work better.

提交回复
热议问题