adspace


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

Answer Posted / dhaval

we have to use distinct key word there is a possibility
that two person having same salary.



select top 1 sry from (select distinct top 2 sry from emp
order by sry desc)t1 order by sry asc

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between openrowset and openquery?

1197


What is sql or structured query language?

1228


Why and when do stored procedure recompile?

1064


List out the different types of locks available in sql server?

1051


What is a scheduled job or what is a scheduled task?

1040


How do I create a trace in sql server?

1121


How can you append an identity column to a temporary table?

1071


What are the source of constraints?

1010


What is in place upgrade in sql server?

1127


What are the different subsets of sql?

1655


Explain “row_number()” in sql server with an example?

1080


Where can you add custom error messages to sql server?

1215


Why should you use or avoid select * statements?

1112


What are the different types of subquery?

1235


How do I find query history in sql server?

1026