how can we find nth max salary from A table

Answers were Sorted based on User's Feedback



how can we find nth max salary from A table..

Answer / asp

select * from table1 a where (n-1) = (select count(distinct
(sal)) from table1 b where b.sal>a.sal)

Is This Answer Correct ?    15 Yes 5 No

how can we find nth max salary from A table..

Answer / bhaskar reddy

select * from table1 a where(n-1)= (select count(distinct
sal) from table1 b where b.sal>a.sal)

Is This Answer Correct ?    6 Yes 5 No

how can we find nth max salary from A table..

Answer / sivaraman

select * from table1 a where n = (select count(distinct
(sal)) from table1 b where b.sal>a.sal)


n is value of n it should be numeric....

Is This Answer Correct ?    15 Yes 15 No

how can we find nth max salary from A table..

Answer / a

select MAX(Salary) from Employee
WHERE Salary NOT IN (select MAX(Salary) from Employee )

Is This Answer Correct ?    0 Yes 9 No

how can we find nth max salary from A table..

Answer / venkat

select max(sal) from tablename.

Is This Answer Correct ?    7 Yes 51 No

Post New Answer

More DB2 Interview Questions

can i code union in cobol-db2 pgm ?

4 Answers   Patni,


what is the difference between where clause and having clause

2 Answers   IBM,


What is the use of value function?

1 Answers  


How can you find out the # of rows updated after an update statement?

1 Answers  


What is the use of with ur in db2?

1 Answers  


What are data types?

2 Answers  


Can a primary key have null values? If we try to insert a null value in a primary key column, will it work or give an error code?

6 Answers  


What will the FREE command do to a plan?

2 Answers  


Hello All, We have requirment to Replace BMC Db2 Load product thru CA FAST LOADPlus product. Do anyone have JCL to for FAST LOADPLUS and what all are thing need to take in consideration.

1 Answers   IBM,


What are the advantages of using a PACKAGE?

2 Answers  


Cursors can be declared in both working-storage & procedure division, Agreed. But is there any difference? If could you please suggest what is the difference. TIA

8 Answers   CGI, Wipro,


What do you do to keep the cursor from closing after a commit?

1 Answers  


Categories