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
Is rowid unique in oracle?
How many types of synonyms in Oracle?
what is difference between sql plus and sql*plus? (not sql and sql plus).
What is a tns service name?
How to list all user accounts in oracle?
How to use regular expression in pattern match conditions in oracle?
How to delete an existing row from a table in oracle?
what is the difference between data migration and production migration.
How to define a procedure inside another procedure?
In AP we done Customizations for Late Payments Charges. For Reporting Purpose What are the Documents Prepared for Customer Understanding??
Explain what are the advantages of views?
what is dynamic SGA and static SGA
Explain the use of record length option in exp command.
What is primefaces used for?
There are n numbers of flatfile of exactly same format are placed in a folder.Can we load these flatfile's data one by one to a single relational table by a single session??