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

Answer Posted / ram posam

select * from (select deptno,sal,rank() over(partition by
deptno order by sal desc) k
from emp
group by deptno,sal)
where k=&n;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why does oracle 9i treat an empty string as null?

537


What is a static data dictionary in oracle?

564


What view(s) do you use to associate a users SQLPLUS session with his o/s process?

1905


What privilege is needed for a user to query tables in another schema?

502


What is hot backup and logical backup?

604






can u plz provide me oca sql dumps please i need them

1466


What is set operator oracle?

525


What is a sub query? What are its various types?

583


What is the maximum number of triggers that can be applied to a single table?

553


We are using Oracle apps with XML publisher.In that,we are facing some problems while giving a Footer in RTF Template.While giving a footer in RTF Template it is Visible in all the pages,but after the PDF is getiing generated,the Footer are Visible on alternate pages only (like on first page ,third page) and so on. Please provide the Solution for getting the Footer on all the pages.

4930


What spfile/init.ora file parameter exists to force the CBO to make the execution path of a given statement use an index, even if the index scan may appear to be calculated as more costly?

1521


material view and view disadvantages?

633


What is the quickest way to export a table to a flat file?

568


How to bring a tablespace online?

518


What is literal?

587