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
Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?
Explain different forms of normalization?
Is sql server is free?
Explain the concepts and capabilities of sql server?
How many types of attribute relationships are there? : sql server analysis services, ssas
What are the difficulties faced in cube development? : sql server analysis services, ssas
Explain the difference between functions and stored procedures in sql server?
What is sub-query in sql server?
What happens if ntwdblib.dll is missing on your machine?
Explain different types of locks in sql server.
What are the restraints imposed on the table design by a merge replication?
How to modify an existing stored procedure in ms sql server?
What are the types of database schema? : sql server analysis services, ssas
How to transfer data from a cursor to variables with a "fetch" statement?
What are the advantages of sql azure?