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

select sal from (select dense_rank() over(order by sal) rank
from emp) where rank in(1,2);

In above query you will get both highest and second highest
salary details even there are more people who are getting
highest and second highest salary.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

6. Display the client name and order date for all orders using the traditional method.

2299


How to create a new table by selecting rows from another table?

1075


What is the use of file param in imp command?

1158


What is blob datatype?

1116


Can we use bind variables in oracle stored procedure?

944


Explain the use of tables option in exp command.

1106


How can you tell how much space is left on a given file system and how much space each of the file systems subdirectories take-up?

2821


What is merge statement used for?

1018


Please explain joins in oracle?

1056


How to load a large xml file?

1045


State the difference between a primary key and foreign key?

928


How to sort the query output in oracle?

1021


How to get the Installed Oracle Version Information ?

1116


Explain do view contain data?

996


How to create tables for odbc connection testing?

1101