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

What is default constraint in ms sql server?

968


What is meant by indexing files?

988


What is ems sql management studio? : sql server management studio

1040


What are the different types of locks in the database?

877


What is row_number function?

944


Where are stored procedures in sql server?

1010


Describe in brief system database.

955


Why use stored procedures in sql server?

959


How to assign new column names in a view?

865


What is the maximum size of sql server database?

948


What is dbcc command in sql server?

1021


You want to use bids to deploy a report to a different server than the one you chose in the report wizard. How can you change the server url?

148


How to use "if ... Else if ... Else ..." Statement structures in ms sql server?

1002


What are the dmvs?

954


When to use Inner join & when to use subquery?

1083