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

select distinct(a.colname) from table a where &n=(select
count(distinct(b.colname)) from table b where
a.colname<=b.colname);

from this query u can find out Nth MAX in a one query

eg
select distinct(a.sal) from emp a where &n=(select count
(distinct(b.sal)) from emp b where a.sal<=b.sal);

Is This Answer Correct ?    55 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the restrictions on external table columns?

991


In not less than 100 words what's the main difference between Rolap and Molap in ORACLE ?

2212


Explain oracle’s server parameter file.

947


What is bulk load in oracle?

1005


Explain integrity constraints?

1057


Explain what are the characteristics of data files?

1030


Write a trigger example in oracle?

980


How to create lov dynamically at runtime & attach to text field?

1097


Can we call procedure inside function in oracle?

1018


How to login to the server without an instance?

1103


hi friends i completed b.com 2004.i have 3y accounting exp. in manufacturing company.now i have completed oracle finance.pls suggest me how will get job in oracle.can i get job in oracle.

2319


What are the differences between interval year to month and interval day to second?

964


What is meant by an index?

1058


what is insert all statement in sql

6393


Name the various constraints used in oracle?

969