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...

Find top Nth employee from each department in terms of
salary?

Answer Posted / sandeep modapathi

SELECT DISTINCT MIN(SALARY),DEPARTMENT
FROM (SELECT TOP ((SELECT COUNT(DISTINCT DEPARTMENT) FROM
EMPLOYEE)*@N)
SALARY,DEPARTMENT
FROM EMPLOYEE ORDER BY SALARY DESC
) AS CUR1 GROUP BY DEPARTMENT


try it out ..................
it will show you the Nth top salary for each department

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define normalisation?

1118


What is an example of a primary key?

996


What are the aggregate and scalar functions?

1076


How should i optimize the time for execution of stored procedure having single input and many output from the different tables?

1924


What is the difference between rank and dense_rank?

1099


Difference between connected and disconnected database in .net with sql server?

1109


Can you force a query to use a specific index?

954


How does normalization work?

934


if no size is defined while creating the database, what size will the database have? : Sql server administration

1018


What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

1010


What is difference between group by and having?

952


What is RAID? What are the different types of RAID configurations?

1138


Can I save my report as html, excel or word? : sql server management studio

963


Explain the truncate command? : SQL Server Architecture

1184


Can an entity have two primary keys?

987