列中第二高的数字

问题描述:

任何机构都可以告诉我如何从sql server 2005的列中找到第二高的数字吗?

-
10
20
40
60

答案应该是40

Can any body plz tellme how we can find the second highest number from column in sql server 2005?
No
--
10
20
40
60

the ans should be 40

SELECT MAX(SALARY) FROM EMPLOYEE WHERE SALARY < (SELECT MAX(SALARY) FROM EMPLOYEE)


SELECT SALARY FROM Employee t1 WHERE
2=(SELECT COUNT(DISTINCT t2.SALARY) FROM Employee t2 WHERE t2.SALARY >= t1.SALARY)


我已经给出了在这个线程中.检查一下

点击此处
I have given this ans in this thread. Check it out

click here