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

How to call a stored function in oracle?

1021


How do I escape a reserved word in oracle?

1202


how to convert .db (extention) database file into .dmp (extention ) for oracle database ?

2559


Explain how are indexes update?

1071


Explain oracle’s server parameter file.

999


What is data block in Oracle?

1118


What is the difference between formal parameters and actual parameters?

1090


Where are the settings stored for each instance in oracle?

1108


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

1024


Why does Oracle not permit the use of PCTUSED with indexes?

2427


Explain the use of analyse option in exp command.

1131


What is the difference between 10g OEM and 11g OEM?

969


State the difference along with examples between Oracle 9i, Oracle 10g and Oracle 11i.

1035


What is the difference between the Oracle ODBC driver and a Microsoft ODBC (Open Database Connectivity) Driver?

1121


you are a universe designer and report developer in BO, what type of information you gather from client?Briefly explain plz

1945