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 / bobby
SELECT sm ,custid ,ordyear,amount FROM
(SELECT sm ,custid ,ordyear,amount,Rank() OVER (ORDER BY
amount desc)as Rank
FROM dbo.OrderCust)p where rank=2
This is used to select all the rows having the second max
salary.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is nested transaction?
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?
Explain hostprotectionattribute in sql server 2005?
What are the characteristics of modern DBMS?
what does the automatic recovery do? : Sql server administration
What is the maximum row of a size?
Explain differentiate between a having clause and a where clause?
What are the main differences between #temp tables and @table variables and which one is preferred?
What is difference between count (*) and count column?
What are different types of statement?
What are the different types of columns types constraints in the sql server?
What is the purpose of a table?
What do you understand by check constraint in sql server?
How to download and install microsoft .net framework version 2.0?
How to drop an existing schema in ms sql server?