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 / deepa
drop table #temp
select top 2 identity(int,1,1) as SlNo, *
into #temp from employee order by salary desc
select * from #temp where SlNo = 2
Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is the difference between locking and multi-versioning?
What is importing utility?
How fixed length strings are truncated and padded?
How to create a stored procedure with a statement block in ms sql server?
Can multiple columns be used in sql group by clause in ms sql server?
Why can there be only one clustered index and not more than one?
What is co-related sub query?
What is sql server locking?
How to create a testing table with test data in ms sql server?
How many triggers are possible per table?
How do I delete a sql server database?
What is scalar user-defined function?
Explain candidate key, alternate key, and composite key?
Where sql server user names and passwords are stored in sql server? : sql server database administration
What are the instances when triggers are appropriate?