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
How to open a cursor variable?
What is oracle sid?
Explain an extent?
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?
How to start your 10g xe server from command line?
Why is oracle so popular?
How to load a large xml file?
How to write an inner join with the where clause in oracle?
What does sharding mean?
How to use an explicit cursor without open statements?
How to install oracle database 10g xe?
How do I limit the number of rows returned by an oracle query after ordering?
How to insert a new row into a table in oracle?
What is a dynamic performance view in oracle?
what is Single Byte Overhead...?