How to find the second largest salary in the emp database and
also How to find 3rd,4th and so on ........ in the emp database

plz mail the answer @ mak2786@gmail.com

Answer Posted / aditya kumar bisoi

SELECT EmpId,Salary
FROM(SELECT ROW_NUMBER() OVER(ORDER BY Salary Desc) AS [ROW_NUMBER],* FROM (SELECT DISTINCT Salary,Empid FROM EMPDetails)Emp)Emp1
WHERE ROW_NUMBER BETWEEN 2 AND 5

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is dbcc?

741


What is failover clustering overview?

598


What is Lock table in SQL?

1012


What are the advantages of passing name-value pairs as parameters?

667


How do I get Report Builder to generate a parameter that can be set by users viewing the report?

100






How to transfer data from a cursor to variables with a "fetch" statement?

590


Tell me what is difference between view and materialized view?

530


Types of Authentications in Sql Server? How user gets authenticated through windows authentication?

573


What is the purpose of self join?

511


application server is slow what may be the problem

1789


What is the difference between a check constraint and a rule?

630


Why use “pivot” in sql server?

629


Which operator do you use to return all of the rows from one query except rows are returned in a second query?

577


What is difference between group by and having?

568


What is transaction server auto commit?

583