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

select max(sal),1 no
from emp
union
select sal,rn from (select sal,rownum rn from emp)
where rn = 2
order by 1 desc;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we store images in oracle database?

964


How to create a testing table in oracle?

966


How to convert characters to dates in oracle?

1054


How do I use os authentication with weblogic jdriver for oracle and connection pools?

1017


What are the limitations of check constraint?

987


What is a select query statement in oracle?

923


How to insert a record into a table?

1038


What is a nested table and how is it different from a normal table?

1011


What are the oracle differences between nvl and coalesce

1101


How to list all user accounts in oracle?

994


What is a cursor variable?

1071


How to create a server parameter file?

1099


When do you get a .pll extension in oracle? Explain its importance

1009


What is the relation of a user account and a schema in oracle?

1037


If youre unsure in which script a sys or system-owned object is created, but you know its in a script from a specific directory, what UNIX command from that directory structure can you run to find your answer?

2103