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 you explain important index characteristics?
What protocol does sql server use?
What are the differences between char and varchar in ms sql server?
How to write an inner join with the where clause in ms sql server?
Can we run Reporting Services with SQL Server express edition, which is a free version of SQL Server?
What is resource governor?
Define Joins?
Is sql server is free?
How to provide login information for a new odbc dsn?
What are filegroups in sql server?
How will you find out if there are expensive SQL statements running or not?
Explain different types of locks in sql server.
Is it possible to call a stored procedure within a stored procedure?
how can you check the level of fragmentation on a table? : Sql server administration
What do you mean by an execution plan?