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 / 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


Please Help Members By Posting Answers For Below Questions

What are the types of partitions in oracle?

995


What is procedure overloading in oracle?

1011


how to make an oracle object

2319


Is it possible to split the print reviewer into more than one region ?

2238


How many types of database triggers exist?

1083


What are the database administrators utilities available?

991


How can I introduce multiple conditions in like operator?

946


Please explain oracle left join with an example?

990


what are archived logs?

2163


How to use attributes of the implicit cursor in oracle?

968


Explain what are the different type of segments?

925


definition of cluster and non-clustered index?

2984


Explain what are the characteristics of data files?

1051


How can I create database in oracle?

975


What is a nvl function? How can it be used?

975