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

How we can compare two database data?

956


what is sql server? : Sql server database administration

997


what do you understand by change data capture?

1033


What is the sql case statement used for?

1106


What is report subscription?

128


How to find the list of fixed hard drive and free space on server?

1207


What is the partitioning method?

1027


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

1129


How do I start sql server 2017?

948


How can I check if a view exists in a sql server database?

1045


Data is not being delivered to subscribers, what can be the possible reasons? : sql server replication

1053


How exceptions can be handled in sql server programming?

1019


What is difference between stored procedure and user defined function?

1118


Can you name some of the dml commands in sql?

1038


What are the rules to use the rowguidcol property to define a globally unique identifier column?

1025