Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / ajit

select max(sal),1 no
from emp
union
select sal,rn from (select sal,rownum rn from emp)
where rn = 2
order by 1 desc;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to rename an index in oracle?

1063


What is the difference between online and offline backups?

973


How to export several tables together?

989


What is a table in oracle?

928


How to convert character types to numeric types?

1056


Explain the use of control file?

1061


What is meant by a deadlock situation?

1053


What is rowid and rownum in oracle?

954


What are the different types of record groups in oracle? Explain each of them

972


How to bring a tablespace online?

998


what are the advantages of running a database in archive log mode?

2144


Explain the features of oracle?

991


Will you be able to store pictures in the database?

1063


Give the different types of rollback segments.

980


How to set a transaction to be read only in oracle?

1033