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


Please Help Members By Posting Answers For Below Questions

How many types of database relationship in sql server?

561


What are the types of ssrs?

108


How to create an index on an existing table in ms sql server?

497


Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security

705


What are the new features of sql server 2012 reporting service?

84






hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail

1788


What is default port number for sql server 2000?

598


How do you delete a trigger?

584


What is for xml in sql server?

540


What is the difference between row_number and dense_rank?

442


What are acid properties of transaction?

553


How do you set a trace flag in sql server?

557


What is partitioned view?

523


What is the web service used for reporting services?

98


How do you troubleshoot errors in a SQL Server Agent Job?

562