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 different types of backups avaialabe in sql server? : Sql server database administration
How do you check sql server is up and running?
Explain trigger and its types?
what changed between the previous version of sql server and the current version? : Sql server database administration
While using a cursor, how can you differentiate between a deleted row and a row that has been inserted with null data values?
Why is replication required on the sql server?
What do you mean by sql server agent?
What command must you use to include the not null constraint after a table has already been created?
Describe the left outer join & right outer join. : sql server database administration
What are the drawbacks of reporting in ssrs?
Describe in brief sql server monitoring ways.
When do you think a developer should use sql server-based cursors?
Mention the command used to rename the database.
What happens if the update subquery returns no rows in ms sql server?
What is a subquery in a select query statement in ms sql server?