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 / ashish
hey u can try This It defenately work...It for The nth
position mean for the N th node try it out.......
SELECT *
FROM emp A
WHERE (n-1) = (
SELECT COUNT(DISTINCT(B.salary))
FROM emp B
WHERE B.salary > A.salary)
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
how would you improve etl (extract, transform, load) throughput?
Why do you need a sql server?
What to perform pattern match with the like operator?
How to get a list of columns in a view using the "sp_columns" stored procedure?
How to write an inner join with the where clause in ms sql server?
How to fine-tune reports?
What is transact-sql language?
Explain the microsoft sql server delete command?
What is the usage of the sign function?
What is cte (common table expression)?
Does a server store data?
What is identity?
How to add the custom code in Report?
How to create a view on an existing table in ms sql server?
Tell me what is the difference between locking and multi-versioning?