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 / eldho k scaria

There are two methods:(Suppose table name is EMPLOYEE,
Colomn name is SALARY, and N=6)

SELECT * FROM EMPLOYEE
WHERE SALARY IN
(SELECT TO 1 SALARY (SELECT DISTINCT TOP 6 SALARY FROM
EMPLOYEE ORDER BY SALARY DESC)
A ORDER BY SALARY)
or
SELECT * FROM EMPLOYEE E1
WHERE (6-1)=(SELECT COUNT (DISTINCT (E2.SALARY))
FROM EMPLOYEE E2
WHERE E2.SALARY>E1.SALARY)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When you use @@error and try-catch?

1098


What is microsoft sql server?

1014


What is the command used to recompile the stored procedure at run time?

1121


What new data source types were added in ssrs 2014?

169


Difference between primary key and clustered index?

1065


Can group functions be mixed with non-group selection fields in ms sql server?

999


How except clause is differs from not in clause?

1009


Is it true that rules do not apply to data already existing in a database at the time the rule is created?

1089


Explain the properties of a relational table?

1079


What is a data source or ds? : sql server analysis services, ssas

1053


Explain different types of collation sensitivity?

1032


Can you get second highest salary from the table?

1010


Describe in brief system database.

1076


Can another user execute your local temporary stored procedures?

1027


What is primary key and example?

998