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

Which is better Oracle or MS SQL? Why?

4868


Explain oracle data types with examples?

982


Compare and contrast between sql and sql server and explain its various functions?

935


can anyody please send me the dump for Oracle 10g certifications for DBA path?

2104


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

2591


Explain the truncate in oracle?

928


What is a table in oracle?

954


How to store only time; not date and time?

984


Write a trigger example in oracle?

1007


I creat Credit memo in AR. Now i want revers the Credit Memo.how you can revers that what out any aditional entry.

2284


What is the difference between the Oracle ODBC driver and a Microsoft ODBC (Open Database Connectivity) Driver?

1058


How to do a full database export?

1067


query optmization techniques and quwry analyser+projects+ppts

2388


How to resolve name conflicts between variables and columns?

1000


What happens in oracle commit?

985