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

The below query will provide the max and second max in
oracle in one query

select * from emp e
where 0 = (select count(sal) from emp
where e.sal < sal)
or 1 = (select count(sal) from emp
where e.sal < sal);

Is This Answer Correct ?    17 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I creat Credit memo in AR. Now i want revers the Credit Memo.how you can revers that what out any aditional entry.

2309


How to use "out" parameter properly?

1082


What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?

1048


What do you mean by a database transaction & what all tcl statements are available in oracle?

994


What is Data Dictionary Cache in Oracle?

1166


Why use resource manager in Oracle?

1107


What are group functions in oracle?

1042


Can we call procedure inside function in oracle?

1097


What exactly do quotation marks around the table name do?

964


What are the different types of synonyms?

1140


What is an oracle and why it is used?

1150


I have a database backup file in .db (ext) form how to conver it into .dmp (ext.) for oracle database

2138


Can you have more than one content canvas view attached with a window ?

2333


What is the difference between substr and instr?

1037


How do we get field detail of a table?

1081