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

Why use “in” clause in sql server?

996


Suggest a method of joining two tables.

1104


What is user defined datatypes and when you should go for them?

966


query processing

2104


What happens if the update subquery returns multiple rows in ms sql server?

1058


What is db stored procedure?

816


What are the drawbacks of reporting in ssrs?

141


What is implicit cursors?

1006


What is simple indexing method?

972


How to insert multiple rows with a subquery?

1062


What is primary key and example?

898


How can you tell if a database object is invalid?

1017


What is a view in sql?

929


Can you pass expressions to function parameters?

1034


Explain optimistic and pessimistic concurrency?

930