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 / sarmistha mohanty

select * from (
select SAL,
row_number() over (partition by 1 order by SAL DESC)
as rank
from <table name> ) where rank in (1,2)

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain an exception and its types?

1135


Why should I use oracle database?

1046


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

1150


How to get a list of all background sessions in the database?

1040


Explain the use of constraints option in exp command.

1082


How to export your connection information to a file?

1176


What are joins, explain all types of joins?

2361


Explain the difference between sap and oracle?

1086


Give syntax for SQL and ORACLE joins.

1145


How to check the oracle tns settings?

1088


is there a tool to trace queries, like profiler for sql server?

1197


Explain compound trigger in oracle?

1089


How to get maxsal , minsal, ename department wise in single query

1603


What is the purpose of save points in oracle database?

1201


Explain the different normalization forms?

1157