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 define a record variable to store a table row?
What is the use of oracle?
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 can db_files > maxdatafiles since db_files is for instance and the later is for database
Explain a private synonyms?
How to create a table index in oracle?
How to change user password in oracle?
what is insert all statement in sql
What is max rowid in oracle?
How to select some rows from a table in oracle?
What is where clause in oracle?
How do I connect to oracle database?
How to define an external table with a text file?
What is connection pooling in oracle?
What is oracle thin client?