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

Whats the benefit of dbms_stats over analyze?

1954


How to work with data objects interactively?

933


Can we save images in a database and if yes, how?

1007


How many types of tables supported by oracle?

1031


What is oracle latest version?

1046


What is oracle database client?

988


if you ctreate table identity

2325


What is Segment Advisor in Oracle?

1064


How many types of table in Oracle?

1075


Explain a segment?

1039


What is an oracle recycle bin?

945


Can we commit inside a function in oracle?

931


Can we create trigger on materialized view in oracle?

946


What is the minimum client footprint required to connect c# to an oracle database?

1035


 How to use an oracle sequence generator in a mapping?

1031