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

hey u can try This It defenately work...It for The nth
position mean for the N th node try it out.......



SELECT *
FROM emp A
WHERE (n-1) = (
SELECT COUNT(DISTINCT(B.salary))
FROM emp B
WHERE B.salary > A.salary)

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between primary key and clustered index?

1007


What are the benefits of filtered indexes?

1040


Explain the dbcc pintable command when would you use it?

920


What is the cartesian product of table?

1009


Explain the concept of view and Types of views in SQL server?

993


Describe how to use the linked server?

1143


How to update multiple rows with one update statement in ms sql server?

1204


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

1223


How will you decide the active and passive nodes?

1129


What are cursors and when they are useful?

1089


Explain about temporary stored procedure?

1018


How to drop an existing user defined function in ms sql server?

1025


What is a rownum?

977


How to find tables without indexes?

1090


What is a partition key?

954