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...

how can find the second max sal for every group(i.e i want
group the data based on key and find the second max sal for
every group

Answer Posted / sudipta santra

select max(sal),group_nm from
( select sal,dense_rank over (order by sal desc) rank,group_nm
from emp )
where rank=&n
group by group_nm;


Note: here &n is the bind variable which holds value from
the user, based on the requirement either 2nd max or 3rd max
or 5th max.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to open a cursor variable?

974


What is oracle sid?

890


Explain an extent?

1051


I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?

1047


How to start your 10g xe server from command line?

1001


Why is oracle so popular?

943


How to load a large xml file?

1005


How to write an inner join with the where clause in oracle?

997


What does sharding mean?

946


How to use an explicit cursor without open statements?

1013


How to install oracle database 10g xe?

967


How do I limit the number of rows returned by an oracle query after ordering?

1101


How to insert a new row into a table in oracle?

1096


What is a dynamic performance view in oracle?

948


what is Single Byte Overhead...?

2500