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
Difference between primary key and clustered index?
What are the benefits of filtered indexes?
Explain the dbcc pintable command when would you use it?
What is the cartesian product of table?
Explain the concept of view and Types of views in SQL server?
Describe how to use the linked server?
How to update multiple rows with one update statement in ms sql server?
Why are you getting errors when creating a new odbc dsn?
How will you decide the active and passive nodes?
What are cursors and when they are useful?
Explain about temporary stored procedure?
How to drop an existing user defined function in ms sql server?
What is a rownum?
How to find tables without indexes?
What is a partition key?