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 happens when converting big values to integers?

959


Can I save my report as html, excel or word? : sql server management studio

908


Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security

1014


Write a sql query to display the current date?

1030


What changes in the front end code is needed if mirroring is implemented for the high availability? : sql server database administration

971


How is SQL Azure different than SQL server?

223


After creating the cube, if we added a new column to the oltp table then how you add this new attribute to the cube? : sql server analysis services, ssas

902


What do you mean by tablesample?

1035


What are the different types of Indexes available in SQL Server?

951


What is function of ROLLUP ?

1041


What are functions in the sql server?

1128


How do I change my passwords (database, LDAP, and so on) without causing an outage?

1019


What is policy based management (pbm)? : sql server database administration

931


How to start and end transact-sql statements?

971


What is wrong with sql server client libarary dll, ntwdblib.dll?

996