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

select top 1 id,salary from(select top 2 id,salary from
employee group by id,salary order by salary desc)a order by
salary asc

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if an integer is too big for int date type?

978


Why SQL Agent is used?

1153


What is meant by indexing files?

1043


What is database white box testing?

1123


Difference Between ORDER BY Clause and GROUP BY Clause in SQL?

1059


How dts is used to extract, transform and consolidate data?

1075


What is the impact on other user sessions when creating indexes?

927


What is a dbms wizard?

1021


What is rs.exe utility?

156


What are the ways available in sql server to execute sql statements?

1137


What is view in sql?

907


You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?

1103


What is trigger in salesforce?

983


What is the maximum size of sql server database?

1011


What is the difference between clustered index and primary key?

922