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

What is tns service name?

1122


What is oracle update statement with inner join ?

1052


why should i declare foreign key constraint as self relation instead of binary relation in tables ?

2040


what is the difference between functional dependecy and multilevel dependency?

2455


Explain the use of grant option in imp command.

1020


What are the different types of trigger and explain its various uses and functions?

1085


Please explain oracle left join with an example?

1040


How to define a procedure inside another procedure?

1012


How will you differentiate between varchar & varchar2?

1039


What is an external table?

1012


How to use in conditions in oracle?

1051


How to use null as conditions in oracle?

1075


What are the differences between char and nchar in oracle?

1085


What is pragma autonomous transaction in oracle?

1062


Explain about integrity constraint?

1120