Query to get max and second max in oracle in one query ?
Answer Posted / sumit wadhwa
for max
select a.sal
from emp a
where 1=(select distinct(count(b.sal))
from emp b
where a.sal<=b.sal);
for second max
select a.sal
from emp a
where 2=(select distinct(count(b.sal))
from emp b
where a.sal<=b.sal)
| Is This Answer Correct ? | 33 Yes | 11 No |
Post New Answer View All Answers
What are the types of partitions in oracle?
What is procedure overloading in oracle?
how to make an oracle object
Is it possible to split the print reviewer into more than one region ?
How many types of database triggers exist?
What are the database administrators utilities available?
How can I introduce multiple conditions in like operator?
Please explain oracle left join with an example?
what are archived logs?
How to use attributes of the implicit cursor in oracle?
Explain what are the different type of segments?
definition of cluster and non-clustered index?
Explain what are the characteristics of data files?
How can I create database in oracle?
What is a nvl function? How can it be used?