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

How to view the error log for any specific instance? : sql server database administration

1049


What is a partitioned view?

1008


What is normalization? Explain different forms of normalization?

1170


How do I get to sql server configuration manager?

1018


What are the export options of ssrs?

173


Do you know what is blocking?

969


What is the xml datatype?

1086


What is dbcc?

1147


What is report rendering ?

162


What is the difference between Normalization and De-normalization?

1101


What is the difference between index seek vs. Index scan?

1029


Explain transaction server explicit transaction?

938


What is a trigger? Why we need it?

1005


How to populate a table in sql server?

969


How to count duplicated values in a column in ms sql server?

1100