Query to get max and second max in oracle in one query ?

Answer Posted / bhamidipati srinivas

select (select max(gross) from employee_dtls),(select max
(gross) as nextmaximum
from employee_dtls where gross<(select max(gross) from
employee_dtls)) from dual

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to view the data files in the current database?

594


How do you find out from the RMAN catalog if a particular archive log has been backed-up?

1661


How to view all columns in an existing table?

551


What is a trace file and how is it created in oracle?

554


List the types of joins used in writing subqueries?

573






How to put more than 1000 values into an oracle in clause?

588


How to use "while" statements in oracle?

737


What is the quickest way to fetch the data from a table?

568


Explain the different normalization forms?

595


How do you tell what your machine name is and what is its IP address?

1516


In SAP ECC 6.0 , under DB02 tcode , Tablespace name to be explain stepy step all the col

3702


How to see free space of each tablespace?

596


Assuming that you are an End User How to find that in the payment Batch some of the Invoice was  Missing To pay How to find That??

1274


How to use select statement to count the number of rows in oracle?

557


what is IDE,DMV in sql server?

2248