查询以查找列的nᵗʰ个最大值 [英] Query to find nᵗʰ max value of a column

查看:74
本文介绍了查询以查找列的nᵗʰ个最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到一列的最大值2 nd ,3 rd ,... n th

I want to find 2nd, 3rd, ... nth maximum value of a column.

推荐答案

您可以将列排序为降序格式,然后从第n行获取值。

You could sort the column into descending format and then just obtain the value from the nth row.

编辑::

根据评论请求进行了更新。 警告 完全未经测试!

Updated as per comment request. WARNING completely untested!

SELECT DOB FROM (SELECT DOB FROM USERS ORDER BY DOB DESC) WHERE ROWID = 6

上述类似内容适用于Oracle ...您可能必须先正确使用语法!

Something like the above should work for Oracle ... you might have to get the syntax right first!

这篇关于查询以查找列的nᵗʰ个最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆