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 / chan

SELECT ID, SALARY FROM
(
SELECT ID, SALARY, ROW_NUMBER() OVER (ORDER BY SALARY) AS RN
FROM EMPLOYEE
)
WHERE RN = 1

(YOU CAN CHANGE VALUE OF RN = ANY NUMBER AND YOU WILL GET
THAT VALUE)

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Service Broker in sql server 2012?

1073


How do you debug a procedure in sql server?

992


what is a transaction? : Sql server database administration

1047


How to return the top 5 rows from a select query in ms sql server?

1206


In which sql server version report builder introduced?

150


how to use DTS package in 2000,2005,2008 in sql server

1900


What is query cost in sql server?

1037


Can you explain powershell included in sql server 2008?

989


what are user defined datatypes? : Sql server database administration

1013


How can you find out which stored procedures are recompiling?

948


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

1074


what changed between the previous version of sql server and the current version? : Sql server database administration

1052


What command must you use to include the not null constraint after a table has already been created?

1230


What is data compression?

1064


Explain triggers in sql?

1003