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

how to find nth highest salary

Answer Posted / sysdomain

'top' will fetch only top most : ie top 5 means it will
fetch first 5 rec. After fetching rec only 'order by' is
done ie sorting is done after fetching. therefore using
'top' and 'order by' alone wont get max or min value. for
that we have to use 'distinct' before 'top' along with
'order by' (which will sort
the records before fetching).

select top 1 salary from employee where salary in (select
distinct
top n salary from employee order by salary desc)

Is This Answer Correct ?    3 Yes 9 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a fill factor of 100 and 0?

1032


What will be the maximum number of index per table?

1058


Describe how to use the linked server?

1204


How to retrieve field values using mssql_result()?

1420


How to enable/disable indexes?

1127


How to convert numeric expression data types using the cast() function?

1121


If no size is defined while creating the database, what size will the database have?

1036


role of sql sever 2005 in database rather than any other database

1992


How to create new tables with "select ... Into" statements in ms sql server?

1051


Give an example of SQL injection attack ?

1053


How to create a new schema in a database?

1211


What are the dmvs? : sql server database administration

1122


How many tables can be joined in SQL Server?

1115


What is sqlservr.exe - process - sql server (sqlex?press)?

1156


Why use update_statistics command in sql server?

1113