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

What is use of except clause? How it differs from not in clause?

1022


Explain full-text indexing?

993


How to update multiple rows with one update statement in ms sql server?

1213


Tell me the difference between clustered and non-clustered index?

938


What is difference between inner join and join?

1049


What happens if the update subquery returns no rows in ms sql server?

1125


What according to you is the difference between mysql and sql server performance?

1093


Explain sql server authentication modes?

1138


what are constraints? : Sql server database administration

1061


What are the types of subquery?

1045


What is the difference between char and varchar2 datatype in sql?

1070


Why use view instead of a table?

956


How to drop an existing table?

1013


What is log shipping?

964


What are the different Authentication modes in SQL Server and how can you change authentication mode?

1091