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 define a record variable to store a table row?

1065


What is the use of oracle?

1039


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?

1118


how can db_files > maxdatafiles since db_files is for instance and the later is for database

2636


Explain a private synonyms?

1045


How to create a table index in oracle?

1140


How to change user password in oracle?

1041


what is insert all statement in sql

6540


What is max rowid in oracle?

1035


How to select some rows from a table in oracle?

1084


What is where clause in oracle?

1043


How do I connect to oracle database?

1133


How to define an external table with a text file?

1079


What is connection pooling in oracle?

979


What is oracle thin client?

1031