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
Which is better Oracle or MS SQL? Why?
Explain oracle data types with examples?
Compare and contrast between sql and sql server and explain its various functions?
can anyody please send me the dump for Oracle 10g certifications for DBA path?
how can db_files > maxdatafiles since db_files is for instance and the later is for database
Explain the truncate in oracle?
What is a table in oracle?
How to store only time; not date and time?
Write a trigger example in oracle?
I creat Credit memo in AR. Now i want revers the Credit Memo.how you can revers that what out any aditional entry.
What is the difference between the Oracle ODBC driver and a Microsoft ODBC (Open Database Connectivity) Driver?
How to do a full database export?
query optmization techniques and quwry analyser+projects+ppts
How to resolve name conflicts between variables and columns?
What happens in oracle commit?