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 calcuate the second highest salary of he employee

Answer Posted / jitendra

To get nth highest Salary, use below query

SELECT TOP 1 salary
FROM (
SELECT TOP nth salary
FROM Emp
ORDER BY salary DESC
) TmpTable
ORDER BY salary ASC

Replace nth with your number like second highest=2 4th=4 etc

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you optimize a stored procedure in sql?

960


how can you see all indexes defined for a table? : Sql dba

1000


How do you use a while loop in pl sql?

1015


Do prepared statements prevent sql injection?

953


What is the best free sql database?

1057


What is $$ in sql?

997


Can you skip header records while loading? : aql loader

1054


how can we submit a form without a submit button? : Sql dba

995


How does rowid help in running a query faster?

1417


what is an execution plan? When would you use it? How would you view the execution plan? : Sql dba

984


Can variables be used in sql statements?

1036


what is bcp? When does it used? : Sql dba

991


What does pragma mean?

1060


How many primary keys can a table have?

1009


What is natural join in sql?

991