can anybody tell us, how to select 2nd max salary from
table.
my id is ashish.akk@gmail.com

Answer Posted / syaam

select a.sal from emp a
where 2=(select count(distinct b.sal) from emp b
where a.sal<= b.sal)


for getting nth max sal ..replace 2 by n


all the best

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of paper records?

554


what is unique and xaml nonclustered index

553


What are the new features of sql server 2008 r2 reporting service?

110


Why use “pivot” in sql server?

621


Find nth lowest salary or get nth lowest salary?

591






What is transaction server isolation?

575


You want to generate a report that is formatted as a chart. Can you use the report wizard to create such a report?

88


List the different index configurations possible for a table?

512


What is the largest component inside a field?

530


What is cte (common table expression)?

593


What are the different index configurations a table can have?

507


You are designing a database for your human resources department in the employee table, there is a field for social security number, which cannot contain null values if no value is given, you want a value of unknown to be inserted in this field what is the best approach?

615


What is user-defined multi-statement table-valued function?

655


What language is sql server written in?

527


What purpose does the model database server?

650