how to get the second max val for every group in a table

Answer Posted / suman rana

--venkat u r almost correct, since u have used "" (double
quotes) so column name will be come case sensitive.

select * from (
select e.deptno,d.dname,e.sal,dense_rank() over (
partition by e.deptno
order by e.sal desc ) RANK, e.ename
from emp_test e,dept_test d where e.deptno=d.deptno)
where rank=2

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I introduce multiple conditions in like operator?

550


Whether any commands are used for months calculation? If so, what are they?

594


How to define an anonymous procedure without variables?

545


What are the restrictions on external table columns?

547


How to find out what oracle odbc drivers are installed?

568






interview questions with answer for cts

2082


How to display employee records who gets more salary than the average salary in the department?

594


What are the benefits of ordbms?

619


What is an anonymous block?

621


Can you tell me how to add new column in existing views?how?How is possible?

929


What is the difference between translate and replace in oracle?

648


What are the four Oracle system processes that must always be up and running for the database to be useable?

589


How to use existing values in update statements using oracle?

545


How to write text literals in oracle?

608


Explain the importance of .pll extension in oracle?

551