Query to get max and second max in oracle in one query ?
Answer Posted / bhanu yadav
For Nth Max.
select distinct a.sal from emp a where &N= (select count
(distinct b.sal) from emp b where b.sal>=a.sal)
For Nth Min.
select distinct a.sal from emp a where &N= (select count
(distinct b.sal) from emp b where b.sal<=a.sal)
Is This Answer Correct ? | 9 Yes | 6 No |
Post New Answer View All Answers
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?
What is concurrency in oracle?
How to get last row id?
What are advantages of dateset in datastage?
What is the difference between online and offline backups?
How to invoke the original export import utilities?
What do you mean by group by clause?
What is a tns file?
How to drop a tablespace?
For a field in a repeating frame, can the source come from the column which does not exist in the data group which forms the base for the frame ?
what is reindexing?
What are the data types in oracle?
How to download oracle database 10g xe?
State the various uses of dbcc command?
Explain what are the different type of segments?