I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000
Answer Posted / radhakrishnan vaithilingam
SELECT TOP 1 id.salary
FROM (SELECT TOP 2 id,salary
FROM employee
ORDER BY salary DESC )a
ORDER BY a.salary ASC
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What part does database design plays a role in performance of an sql server-based application?
What is dirty read?
How to execute function in stored procedure sql server?
How to edit table in sql server 2017?
which backup strategy you are following at ur company
What is field with example?
Can we use max in where clause?
What are subqueries in sql server?
What is database white box testing?
What is the difference between clustered and non-clustered indexes in ms sql server?
What is lookup override?
What is the difference between delete and truncate statements?
What are the database roles? : sql server security
What are the differences between decimal and float in ms sql server?
What is hierarchy, what are its types and difference between them? : sql server analysis services, ssas