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 / chan
SELECT ID, SALARY FROM
(
SELECT ID, SALARY, ROW_NUMBER() OVER (ORDER BY SALARY) AS RN
FROM EMPLOYEE
)
WHERE RN = 1
(YOU CAN CHANGE VALUE OF RN = ANY NUMBER AND YOU WILL GET
THAT VALUE)
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is an etl file?
What functions can a view be used to performed?
‘Order by’ is not allowed in a view how can you sort information from a view?
How do I find the size of a sql server database?
What is a collation in ms sql server?
What is the difference between the 2 operating modes of database mirroring?
Explain about analysis services?
How many cores do I need for sql server 2016?
What do you mean by sql server agent?
What is acid mean in sql server?
What are the differences between substr and charindex in sql server.
what is the system function to get current user's user id? : Sql server database administration
How to select true false based on column value in sql server?
How to list all schemas in a database?
Explain what are the basic functions for master, msdb, model, tempdb databases?