Find top Nth employee from each department in terms of
salary?
Answer Posted / madhu sudhan g
Hi,
For suppose the table is like emp having some departments
Here i am retrieving some 'X' department employees
;WITH myTableWithRows AS (
SELECT (ROW_NUMBER() OVER (ORDER BY Salary)) as row,*
FROM emp)
SELECT empname
FROM myTableWithRows
WHERE row = Nth row and
Dept='x'
ORDER BY Salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Tell me what is sql profiler?
Find nth lowest salary or get nth lowest salary?
What are functions in the sql server?
What is the library index called?
What are different type of Collation Sensitivity?
To automatically record the time on which the data was modified in a table, which data type should you choose for the column?
Does server sql treat char as a variable-length or fixed-length column?
What is @@error in sql?
What is xdr?
What are the requirements to use odbc connections in php scripts?
what are cursors? : Sql server database administration
What happens if you add a new index to large table?
How will you decide the active and passive nodes?
Can a table have 2 primary keys?
What is the use of group by clause?