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' (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 ?    7 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is built-in/administrator?

1075


how do you determine the Load performance of any query in sql server {example how do u determine performance of a select stmnt which returns Dynamically many no of records ... some times 100,1000,10000 etc., }

2415


What is the importance of three tier architecture?

1142


Why is normalisation important?

989


What is the use of custom fields in report?

1042


Can you please explain the difference between function and stored procedure?

1048


What's the information that can be stored inside a bit column?

1070


What are the events recorded in a transaction log?

1046


What is the usage of sign function?

1176


Does dbcc checkdb requires db to be in single_user mode? : sql server database administration

1030


How efficient you are in oracle and SQL server?

1221


How many replicas are maintained for each sql azure db?

124


What is store procedure? When do you use?

986


What is the maximum size per database for sql server express?

1103


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

1055