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

Can group functions be mixed with non-group selection fields?

1073


How many types of tables supported by oracle?

1118


What is the exact use of Collections?

2190


how can we store any pdf file in oracle

2217


How to use "startup" command to start default instance?

1099


Is there a combination of "like" and "in" in sql?

1114


What privilege is needed for a user to create indexes in oracle?

1078


Explain what are the different type of segments?

1003


What is catalog in Oracle?

1434


Can we write dml statement in function in oracle?

1123


Can you assign multiple query result rows to a variable?

1035


What do you mean by merge in oracle and how can we merge two tables?

1095


How to see the table columns used in an index?

1070


Explain the characteristics of oracle dba?

1175


What are set operators?

1136