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 are the dis_advantages of stored procedures, triggers, indexes?
What is filtered index?
What is candidate key with example?
What are different types of views?
What is logshipping and its purpose?
As per your opinion what are the five top responsibilities of a dba? : sql server database administration
How to apply filtering criteria at group level with the having clause in ms sql server?
What is forward - only cursors / read only cursor?
What is temporal table?
What to perform pattern match with the like operator?
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
What is federation member?
What function does a database engine serve in the sql server?
What are the indexes in sql server?
What is correlated subquery in sql server?