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

What are the benefits of ordbms?

1088


What do you understand by a database object?

1068


What is index in Oracle?

1075


How to write date and time interval literals in oracle?

1036


Can we store pictures in the database and if so, how it can be done?

1046


How to download oracle database 10g xe?

1018


Can we call procedure inside function in oracle?

1098


What are the differences between char and nchar in oracle?

1096


Explain the use of log option in exp command.

1122


What happens if recursive calls get out of control?

1083


What is ordinary table in oracle?

1159


How to compare dates in oracle sql?

1107


How to define and use table alias names in oracle?

944


What are the differences between primary key and unique key?

1010


i wrote a pl/sql procedure. it must run every sunday 4.40 How can i schedule it with the help of dbms_jobs (or another other procedure with out creating bat file,exe file)

2322