Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

What is the function of model design accelerator?

0 Answers  


---------------Can we use more than 1 Fact table ?

2 Answers   Bank Of America,


pls ans what are the filters we have in framework manager? filters in report studio?

3 Answers   IBM,


is cognos 7 is better than cognos 8

0 Answers   TCS,


Hi, I got a requirement wehre in in a drill through report , in parent report i have a column of numbers on which i have to apply drill through to child report.The condition is in that column if the number ia not zero the drill through link should appear (i.e., 1 to 9) if its 0 or negative number link should not appear. How ? Help would be appreciated

1 Answers   IBM,


These are the questions asking in many interviews, so pls help me,,, How did you get requirements from the client? How did you send reports to the client? How did you interact with your client? I mean through e- mail or phone or in any other way?

6 Answers   IBM, Logica CMG,


What is a scope? can you tell me one example for scope?

1 Answers   CTS, IBM, TCS,


What is Parametermap?

2 Answers  


Can you define cognos impromptu?

0 Answers  


What do you mean by drill through report?

0 Answers  


what is the diff. between a link n a union? what is a custom view? what is the use of unlocking a report ? plz answer to these

0 Answers  


what is slowly growing dimension??

6 Answers   Accenture,


Categories