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

What is replication with database mirroring? : sql server database administration

1049


What stored by the msdb?

979


Can I save my report as html, excel or word? : sql server management studio

929


How can I change procedure name in sql server?

1032


How do I view a trc file?

922


Can we use custom code in ssrs?

1096


What is use of @@ spid in sql server?

1195


What are the different types of join?

1144


write an SQL query to list the employees who joined in the month of January?

1664


Define clusters?

1035


What is cte (common table expression)?

1014


What are the underflow and overflow behaviors on float literals?

1098


What is cube dimension? : sql server analysis services, ssas

986


What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?

935


How to loop through result set objects using mssql_fetch_array()?

1052