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

I Have Employee table having column name as ID,SALARY
how to get second max salary from employee table with id
ex
ID SALARY
1 20000
7 37000
2 5000

Answer Posted / bobby

SELECT sm ,custid ,ordyear,amount FROM
(SELECT sm ,custid ,ordyear,amount,Rank() OVER (ORDER BY
amount desc)as Rank
FROM dbo.OrderCust)p where rank=2


This is used to select all the rows having the second max
salary.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is nested transaction?

1141


Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?

1124


Explain hostprotectionattribute in sql server 2005?

1075


What are the characteristics of modern DBMS?

1141


what does the automatic recovery do? : Sql server administration

1081


What is the maximum row of a size?

1071


Explain differentiate between a having clause and a where clause?

954


What are the main differences between #temp tables and @table variables and which one is preferred?

1136


What is difference between count (*) and count column?

950


What are different types of statement?

1086


What are the different types of columns types constraints in the sql server?

1135


What is the purpose of a table?

998


What do you understand by check constraint in sql server?

1019


How to download and install microsoft .net framework version 2.0?

1185


How to drop an existing schema in ms sql server?

1147