Redian新闻
>
[合集] To get the 2nd, 3rd, 4th largest value
avatar
[合集] To get the 2nd, 3rd, 4th largest value# Database - 数据库
E*i
1
☆─────────────────────────────────────☆
yiyayiyayo (Mera naam Itiaan hai) 于 (Wed May 16 23:34:48 2007) 提到:
It is pretty easy to get the largest value of a field. e.g.:
select max(salary) from employees;
How do you get the 2nd largest value? Or the 3rd largest?
Do this:
select salary, rn from
(select salary, row_number() over (order by salary desc) rn
from employees) x
where rn=2;
☆─────────────────────────────────────☆
q101 (^(?:[DX]?HT|X|YA)ML$) 于 (Wed May 16 23:44:23 2007) 提到:
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。