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
Explain use of expression builder.
Explain the cursor lock types?
What is outer join in sql server joins?
How many types of triggers in sql server?
What are the difference between clustered and a non-clustered index?
What is transact-sql ddl trigger?
What are the different types of lock modes in sql server 2000?
Explain linked server in sql?
Do you know what are the reporting services components?
What are the steps you should follow to start sql server in single-user mode?
Can you explain important index characteristics?
How many primary keys are possible in a table?
What is the library index called?
How can you know if the row fetched from cursor is still valid in underlying table?
What is the default value of an integer data type in sql server 2005?