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
What are ddl triggers and types of ddl trigger?
Find columns used in stored procedure?
What are the new features in SQL Server 2005 when compared to SQL Server 2000?
How to find Duplicate Records In table?
What is clr ddl trigger?
Do you know nested transaction?
What is a non equi join?
When setting replication, is it possible to have a publisher as 64 bit sql server and distributor or subscribers as a 32 bit sql server?
what protocol both networks use? : Sql server database administration
How does recursive cte works in sql server?
What do you mean by data integrity?
How to create a local temporary stored procedure?
What is the use of @@spid?
What is a group function explain with an example?
How to convert a table data in XML format in sql server?