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

How to define and use table alias names in oracle?

885


How to write date and time literals in oracle?

949


Can we commit inside a function in oracle?

920


What do you mean by redo log file mirroring?

978


How to create tables for odbc connection testing?

1011


Explain user account with reference to oracle.

929


How to call a sub procedure?

1036


What is java oracle used for?

973


Explain coalesce function?

1119


What is flashback in Oracle?

967


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

1015


What are the arithmetic operations?

1026


How to create a server parameter file?

1081


How to bring a tablespace offline?

1001


Is truncate autocommit in oracle?

1025