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
Why use “in” clause in sql server?
Suggest a method of joining two tables.
What is user defined datatypes and when you should go for them?
query processing
What happens if the update subquery returns multiple rows in ms sql server?
What is db stored procedure?
What are the drawbacks of reporting in ssrs?
What is implicit cursors?
What is simple indexing method?
How to insert multiple rows with a subquery?
What is primary key and example?
How can you tell if a database object is invalid?
What is a view in sql?
Can you pass expressions to function parameters?
Explain optimistic and pessimistic concurrency?