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


Please Help Members By Posting Answers For Below Questions

Tell me what is sql profiler?

976


Find nth lowest salary or get nth lowest salary?

965


What are functions in the sql server?

1126


What is the library index called?

996


What are different type of Collation Sensitivity?

944


To automatically record the time on which the data was modified in a table, which data type should you choose for the column?

886


Does server sql treat char as a variable-length or fixed-length column?

950


What is @@error in sql?

1020


What is xdr?

929


What are the requirements to use odbc connections in php scripts?

1057


what are cursors? : Sql server database administration

991


What happens if you add a new index to large table?

881


How will you decide the active and passive nodes?

1068


Can a table have 2 primary keys?

930


What is the use of group by clause?

899