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
How to view the error log for any specific instance? : sql server database administration
What is a partitioned view?
What is normalization? Explain different forms of normalization?
How do I get to sql server configuration manager?
What are the export options of ssrs?
Do you know what is blocking?
What is the xml datatype?
What is dbcc?
What is report rendering ?
What is the difference between Normalization and De-normalization?
What is the difference between index seek vs. Index scan?
Explain transaction server explicit transaction?
What is a trigger? Why we need it?
How to populate a table in sql server?
How to count duplicated values in a column in ms sql server?