Query to get max and second max in oracle in one query ?
Answer Posted / sumit wadhwa
select distinct(a.colname) from table a where &n=(select
count(distinct(b.colname)) from table b where
a.colname<=b.colname);
from this query u can find out Nth MAX in a one query
eg
select distinct(a.sal) from emp a where &n=(select count
(distinct(b.sal)) from emp b where a.sal<=b.sal);
| Is This Answer Correct ? | 55 Yes | 16 No |
Post New Answer View All Answers
What are the restrictions on external table columns?
In not less than 100 words what's the main difference between Rolap and Molap in ORACLE ?
Explain oracle’s server parameter file.
What is bulk load in oracle?
Explain integrity constraints?
Explain what are the characteristics of data files?
Write a trigger example in oracle?
How to create lov dynamically at runtime & attach to text field?
Can we call procedure inside function in oracle?
How to login to the server without an instance?
hi friends i completed b.com 2004.i have 3y accounting exp. in manufacturing company.now i have completed oracle finance.pls suggest me how will get job in oracle.can i get job in oracle.
What are the differences between interval year to month and interval day to second?
What is meant by an index?
what is insert all statement in sql
Name the various constraints used in oracle?