i have a table with 3 columns country,empname,salary and i want the query for get the  name of the employees who is getting top 2 nd highest salary for individual country?
Thanks in advance 

Answers were Sorted based on User's Feedback



i have a table with 3 columns country,empname,salary and i want the query for get the  name of ..

Answer / krish

Query to get 1st max salary from each dept
 
SELECT maxsal, 
       deptno, 
       ename 
FROM   ( 
                SELECT   Max(sal) OVER (partition BY detpno ORDER BY sal)        AS maxsal, 
                         row_number over (partition BY detpno ORDER BY sal DESC) AS id, 
                         ename, 
                         deptno 
                FROM     emp) 
WHERE  id=1;

just place id=2 instead of id=1 for second max salary 
if ur are expecting more than 1 records with max sal 
replace ROW_NUMBER with DENSE_RANK()

http://netezzamigration.blogspot.com/2014/10/analytic-functions-in-netezza.html

Is This Answer Correct ?    5 Yes 0 No

i have a table with 3 columns country,empname,salary and i want the query for get the  name of ..

Answer / madhu

select * from ( select country,empname,salary, dense_rank() over (partition by country order by salary) rank from emp) where rank <= 2;

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More Cognos Interview Questions

It is possible with out same Queries(both Reports) we can build the drilltrough between them? and how?

1 Answers   HCL,


is cognos 7 is better than cognos 8

0 Answers   TCS,


My problem is as follows I made two pages of the portal; in the first page i have two reports and from one of these i would like to communicate in some way (i.e drill- through?) with the second page that contains four reports (prompt value [product] and three chart [sales revenue, sales quantity and budget]). Particularly I would like to communicate with the report that contains the prompt, passing the Product. How can i drill from the first page of the portal to the second page ? More generally, is it possible to move from one page, containing 2 report, to another page with 4 report, through a drill-through or any other mechanism? Thank in advance.

1 Answers  


Hai frnds, Any body tell to What is Granularuty in cognos Please help me.i can search in so many browsers but i canot get the answer

3 Answers   Wipro,


For example I developed some reports on employee package now I have to develop same reports to another package.How can I change reports to another package?

5 Answers   TCS,






How can we convert imr report into Impromptu web report?

3 Answers  


write a query to display to 10 max record from the employee table?

7 Answers   HCL,


Anybody sugest me either url address or website for cirtification in Cognos from cognos.com !

3 Answers  


how do you deploy a report in cognos 8 to run in maximo6? what r the steps in maximo??

0 Answers   IBM,


What is the use of powerplay web viewer in cognos?

0 Answers  


Hi All, When user run the cognos report, that report output data must be download/available in EXCEL / CSV file.? (like... list report contain PL,PT,PN,RVEN, that excel/csv default download must be list columns PL,PT,PN,REVN) Thanks in Advance, LN.

2 Answers   IBM,


What is the use of powerhouse?

0 Answers  


Categories