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 is a data dictionary and how can it be created?
How to export your connection information to a file?
What is the difference between I and G in Oracle?
Explain the use of analyse option in exp command.
What is Data Dictionary Cache in Oracle?
What is logical backup in oracle?
Explain about integrity constraint?
How to connect to the server with user account: sys?
How many types of auditing in Oracle?
How to write an inner join with the where clause in oracle?
How to name query output columns in oracle?
How to get the Installed Oracle Version Information ?
What is rowid and rownum in oracle?
How to open a cursor variable?
What is ordinary table in oracle?