|
|
TO FIND THE SECOND HIGHEST SAL - Mysql
|
Views : 331
|
|
Tagged in : Mysql
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
TO FIND THE SECOND HIGHEST SAL IN EMP TABLE
select max(sal) from emp where sal not in(select max(sal) from emp)
TO FIND THE 3RD HIGHEST SAL IN EMP TABLE
select max(sal) from emp where sal not in(select distinct top 2 sal from emp order by sal desc)
TO FIND THE Nth HIGHEST SAL IN EMP TABLE
select max(sal) from emp where sal not in(select distinct top N-1 sal from emp order by sal desc) |
|
By - Vijayaprasad, On - 2010-02-15 |
|
|
|