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
What happens if ntwdblib.dll is missing on your machine?
What are unicode character string data types in ms sql server?
What does the on update no action do?
Do you know sql server 2008 backup compression?
What are recommended options to be used while using db mirroring? : sql server database administration
What is the difference between push and pull subscription? : sql server replication
Explain the cursor lock types?
You have a table with close to 100 million records recently, a huge amount of this data was updated now, various queries against this table have slowed down considerably what is the quickest option to remedy the situation?
What is a cache in ssrs?
What is collation sensitivity?
What it means to be triggered?
What is the use of sql profiler in sql server 2012?
What is stretch database in sql server?
What is PROJECTION Operation?
Which rendering formats are affected by the pagesize properties?