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 default constraint in ms sql server?
What is meant by indexing files?
What is ems sql management studio? : sql server management studio
What are the different types of locks in the database?
What is row_number function?
Where are stored procedures in sql server?
Describe in brief system database.
Why use stored procedures in sql server?
How to assign new column names in a view?
What is the maximum size of sql server database?
What is dbcc command in sql server?
You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?
How to use "if ... Else if ... Else ..." Statement structures in ms sql server?
What are the dmvs?
When to use Inner join & when to use subquery?