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 / ankit nanda
select [Salary],ID from (select [Salary], ROW_NUMBER() over
(order by Employee.SALARY desc)RowNum from [Employee])e
where e.RowNum=2
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Can we write a distributed query and get some data which is located on other server and oracle database?
When cursors are useful?
How to write the storeprocedure with in the store procedure? and how can we write the store procedure with in a trigger vice versa? plz post me the exact answer?
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
Explain the etl (extraction, transformation, and loading)?
Write an SQL query to obtain the 2nd highest salary.
Explain the different index configurations a table can have?
Can you edit the .rdl code associated with a linked report?
What are the steps you can take to avoid “deadlocks”?
Explain datetimeoffset data type in sal server 2008?
How do I schedule a sql server profiler trace?
How to generate create view script on an existing view?
Can I run multiple instances of sql server 2000 at the same time on one computer?
Why Master database is required?
What is the difference between varchar and nvarchar datatypes?