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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / nathan
SELECT *
FROM (SELECT deptno, sal,
DENSE_RANK () OVER (PARTITION BY deptno ORDER
BY sal DESC)
ranks
FROM emp)
WHERE ranks = 2;
| Is This Answer Correct ? | 2 Yes | 1 No |
How to load data from external tables to regular tables?
How to define a data field as not null?
What is difference between truncate and delete?
Write a syntax for update query in oracle?
How can I combine multiple rows into a comma-delimited list in oracle?
What is the CAP theorem?
Hi friends can u send the oracle 9i full version download link?????????????? please reply ?
What are the factors causing the reparsing of SQL statements in SGA?
How to select the name of employee who is getting maximum sal with out using subquery
Explain the use of tables option in exp command.
How to execute the package in oracle?
How to convert characters to dates in oracle?