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

Mention the differences between having and where clause.

1057


Can you create a logon trigger in sql server 2005 express edition?

1081


Can you roll back the ddl statement in a trigger?

973


How column data types are determined in a view?

961


on line cluster can we make if yes tell me the procedure

2023


What do you mean by recursive stored procedure?

950


where can you add custom error messages to sql server? : Sql server administration

1120


What is a table called, if it has neither cluster nor non-cluster index? What is it used for?

1029


How to select true false based on column value in sql server?

1033


How to stop log file growing too big?

1014


What is resultset concur_updatable?

1019


List few advantages of stored procedure.

981


Can you name some of the dml commands in sql?

1032


Explain Geography datatype in SQL Server

1129


How to filter records of table in SQL SERVER?

1086