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 / radhakrishnan vaithilingam

SELECT TOP 1 id.salary
FROM (SELECT TOP 2 id,salary
FROM employee
ORDER BY salary DESC )a
ORDER BY a.salary ASC

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What language is sql server written in?

989


What does top operator do?

965


What is query processing?

883


Suppose i have a table that contains 5 columns like col1,col2...colm5.I want to import only two column through BCP utility.How to do same through BCP in sybase.

2335


Explain what is cte (common table expression)?

1069


What is a trigger what are the advantages of trigger?

917


Can select statements be used on views in ms sql server?

1004


explain different types of constraints? : Sql server database administration

915


Can a table have 2 foreign keys?

858


How global temporary tables are represented and its scope?

907


Explain log shipping and mention its advantages.

990


What are system databases in ms sql server?

968


How do I determine how many instances of sql server are installed on a computer?

959


What are sql server functions?

939


Why are you getting errors when creating a new odbc dsn?

1170