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

hi this is bhaskar iam working in Tcs u want any real time faqs send me your qs i will ans that qs ok this is my id bhaskarparitala.rao@gmail.com

0 Answers  


how to do page breaks in cognos 8 Report studio pls give the navigation

4 Answers  


i thought to keep fake experience..as a fresher i can't enter..bcos there is a large gap after my graduation..4 years..any person who enter with fake exp describe how to attend the interview process..

0 Answers  


Can we create reports using OLTP database?How?

3 Answers  


How do you call a store procedure within a transformation?

0 Answers  


what is dimention?explain dimentable with example?

3 Answers   Syntel,


Can i apply drill through on chart in report studio?

4 Answers   TCS,


What are the components of the report studio?

0 Answers  


How is possible this scenario using in type-in prompt.?

0 Answers  


Where do you edit cognos sql in report studio?

3 Answers   HCL,


Usage of Stored Procedures in Cognos

1 Answers   General Motors GM, TCS,


i wanna some client names and project names in cognos? plz send cognos resumes(3+) exp plz plz plz help me??

1 Answers   TCS,


Categories