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
Mention the differences between local and global temporary tables.
Explain difference between cross join and full outer join?
What is the difference between Stored Procedures and triggers?
What is 2nf example?
How is SQL Azure different than SQL server?
What is difference between equi join and inner join?
Define the one-to-one relationship while designing tables.
What is a system database and what is a user database?
What is the recovery model? List the types of recovery model available in sql server?
Explain collation?
What is a partition function in sql server?
What is star, snowflake and star flake schema? : sql server analysis services, ssas
What are the different types of subquery?
How can you ensure that the database and sql server based application perform well?
Is it possible to replicate data from sql server to oracle? : sql server replication