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 is a data dictionary and how can it be created?

1238


How to export your connection information to a file?

1176


What is the difference between I and G in Oracle?

1149


Explain the use of analyse option in exp command.

1195


What is Data Dictionary Cache in Oracle?

1243


What is logical backup in oracle?

1083


Explain about integrity constraint?

1177


How to connect to the server with user account: sys?

1061


How many types of auditing in Oracle?

1086


How to write an inner join with the where clause in oracle?

1089


How to name query output columns in oracle?

1241


How to get the Installed Oracle Version Information ?

1189


What is rowid and rownum in oracle?

1069


How to open a cursor variable?

1089


What is ordinary table in oracle?

1239