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 the difference between Delete and Truncate command in SQL
Why functions are used in sql server?
What are the differences between clustered and non-clustered index?
Explain sql server authentication modes?
How to replace null values in expressions using isnull()?
Explain about unique identifier data type in sql server?
What will be the value of @@fetch_status if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?
Explain insert into select statement?
System requirements for sql server 2005 express edition?
How to concatenate two strings in SQL Server.
How to delete an existing database user?
What is the default port for SQL Server over a firewall?
What are ddl (data definition language) statements for tables in ms sql server?
What are the steps to process a single select statement?
It is important form e to get the information from log files of applications executed by the task scheduler? Does sql studio save these log files? : sql server management studio