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

SELECT MAX(E1.sal), MAX(E2.sal)
FROM emp E1, (SELECT sal FROM emp
WHERE sal NOT IN ( SELECT MAX(sal) FROM emp)) E2

Is This Answer Correct ?    7 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to get execution statistics reports on query statements?

1090


Can the query output be sorted by multiple columns in oracle?

992


How different is ms access and oracle?

1036


What are joins, explain all types of joins?

2297


How to upsert (update or insert into a table)?

997


Is oracle a relational database?

916


Explain compound trigger in oracle?

1037


You have 4 instances running on the same UNIX box. How can you determine which shared memory and semaphores are associated with which instance?

2005


What is meant by an index?

1139


What are dml statements in oracle?

1095


How to put more than 1000 values into an oracle in clause?

1029


Which dictionary view(s) would you first look at to understand or get a high-level idea of a given Advanced Replication environment?

1880


How do I use unicode codesets with the weblogic jdriver for oracle driver?

1078


How translate command is different from replace?

1083


What happens to indexes if you drop a table?

1169