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
John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?
Why use stored procedures in sql server?
What is tabulation?
What is the rdl file?
What is amo? : sql server analysis services, ssas
How to encrypt data between dialogs?
Does partitioning ssd reduce performance?
Is it possible to have clustered index on separate drive from original table location?
How do you delete duplicate rows in sql server?
What is a print index?
What is ddl command?
why would you call update statistics? : Sql server database administration
What is difference between getdate and sysdatetime in sql server 2008?
How will you decide the active and passive nodes?
Explain syntax for viewing trigger?