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
What is use of except clause? How it differs from not in clause?
Explain full-text indexing?
How to update multiple rows with one update statement in ms sql server?
Tell me the difference between clustered and non-clustered index?
What is difference between inner join and join?
What happens if the update subquery returns no rows in ms sql server?
What according to you is the difference between mysql and sql server performance?
Explain sql server authentication modes?
what are constraints? : Sql server database administration
What are the types of subquery?
What is the difference between char and varchar2 datatype in sql?
Why use view instead of a table?
How to drop an existing table?
What is log shipping?
What are the different Authentication modes in SQL Server and how can you change authentication mode?