Click here to Skip to main content
15,906,455 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Pls some one tell that


how to find 6th highest salary from emp table


Pls some one tell.....
Posted
Comments
ridoy 7-Sep-13 12:40pm    
we don't see your emp table here!

Hello Chander Rani


You can use the following SQL Select Command for your requirement:-

select top 1 * from (select top 6 empid,empname,salary from employees order by salary desc) as t1 order by salary;

Table Name: employees
Salary Column: salary
Other Columns: empid, empname

Please read my recent article in code project and give your comments and rating.
Chat Application in PHP

with regards,

Sunil
 
Share this answer
 
SQL
WITH cte (row,lastname,firstname,salary)
AS(
SELECT TOP 6 ROW_NUMBER() OVER (ORDER BY salary DESC), lastname, firstname,salary FROM salarytable ORDER BY salary DESC
)
SELECT * FROM cte WHERE row=6;
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900