如何从表中找到第二高的薪水。

编程入门 行业动态 更新时间:2024-10-12 01:23:19
本文介绍了如何从表中找到第二高的薪水。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的 i希望从table.table中找到第二高的薪水,在emp表中包含一些重复值。 表格如.. eid名称薪水depatmentid 100 vijay 66000 10 101 sumit 22000 20 102 sohan 25000 30 103 Bhagat 25000 30 104 sunil 22000 40 105 sumit 24000 40 106 sunil 22000 10 107 kumar 26000 50 108史密斯120033 50 110 arun 12033 10 111 gyanesh 122233 50 112 sunita 10033 40 113 kanchan 120033 50 请帮忙解决这个问题......

dear i want to find second highest salary from table.table contain some duplicate values in emp table. table like.. eid name salary depatmentid 100 vijay 66000 10 101 sumit 22000 20 102 sohan 25000 30 103 Bhagat 25000 30 104 sunil 22000 40 105 sumit 24000 40 106 sunil 22000 10 107 kumar 26000 50 108 smith 120033 50 110 arun 12033 10 111 gyanesh 122233 50 112 sunita 10033 40 113 kanchan 120033 50 pls help to resolve this problem...

推荐答案

快速搜索Q& A这里会发现你先前已经问过21个问题。 Q& A搜索结果 [ ^ ] 如果您真的需要社区的帮助,请对您的主题进行简单的Q& A搜索,看看是否问题已被提出。 A quick search on the Q&A here would have found you 21 previous questions already asked here. Q&A search results[^] If you really want help from the community, please perform a simple Q&A search on your topic ans see if the question had already been asked.

下面的查询会给你更正确的答案: - below query will give you more correct answer:- select * from ( select dense_rank() over (order by sal desc) as num, * from tablename) a where num=2

SELECT MAX( Salary) FROM Emp WHERE Salary < ( SELECT MAX(Salary) FROM Emp )

更多推荐

如何从表中找到第二高的薪水。

本文发布于:2023-11-30 08:24:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649346.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到第   薪水   中找   二高

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!