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

John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?

904


Why use stored procedures in sql server?

979


What is tabulation?

914


What is the rdl file?

135


What is amo? : sql server analysis services, ssas

1064


How to encrypt data between dialogs?

1049


Does partitioning ssd reduce performance?

867


Is it possible to have clustered index on separate drive from original table location?

926


How do you delete duplicate rows in sql server?

921


What is a print index?

858


What is ddl command?

944


why would you call update statistics? : Sql server database administration

1042


What is difference between getdate and sysdatetime in sql server 2008?

1020


How will you decide the active and passive nodes?

1096


Explain syntax for viewing trigger?

897