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
What is dbcc?
What is failover clustering overview?
What is Lock table in SQL?
What are the advantages of passing name-value pairs as parameters?
How do I get Report Builder to generate a parameter that can be set by users viewing the report?
How to transfer data from a cursor to variables with a "fetch" statement?
Tell me what is difference between view and materialized view?
Types of Authentications in Sql Server? How user gets authenticated through windows authentication?
What is the purpose of self join?
application server is slow what may be the problem
What is the difference between a check constraint and a rule?
Why use “pivot” in sql server?
Which operator do you use to return all of the rows from one query except rows are returned in a second query?
What is difference between group by and having?
What is transaction server auto commit?