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 / sudip mondal
select top 1 from employee where ID in (select top2 ID from
employee order by Salary desc) order by Salary asc
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Define cursor locking
How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
What is join and name different type of joins?
What is the difference function and stored procedure?
How would you choose between a clustered and a non-clustered index?
What is log shipping? Can we do logshipping with SQL Server 7.0 ?
Tell me what is the difference between locking and multi-versioning?
What is @@rowcount in sql?
Explain what are the database objects? : SQL Server Architecture
How to convert a numeric expression from one data type to another?
What are data regions?
Do you know what is lock escalation?
What is the difference between the application object and session object?
What is difference between equi join and inner join?
How to change parameter value inside the report?