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

select distinct (a.sal),empno from emp a
where &N = (select count (distinct(b.sal))
from emp b where a.sal <= b.sal);

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we call UDF(User Define Function) using C# code in ASP.net ?

6949


What is the difference between online clustering and Offline clustering?

2477


Tell me about the approaches which you used to counter the DI problems.

1427


What is the difference between dbcc indexdefrag and dbcc reindex?

1040


What are the system database in sql server 2008?

1097


What are the restrictions that views have to follow? : SQL Server Architecture

1058


What are pages and extents? : SQL Server Architecture

1072


What is difference between views and stored procedures?

1029


What is query cost in sql server?

1037


What is pivot and unpivot?

1066


What are the differences between local and global temporary tables?

1131


What is store procedure? When do you use?

986


What language is sql server written in?

1081


Explain the steps to use transact-sql cursor?

1155


How to connect to a sql server using odbc_connect()?

1203