adspace


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

Answer Posted / govind.konduri

hai..

select sal from emp where sal=(select max(sal) from
emp where sal<(select max(sal) from emp))

->here,the sub inner query finds the max sal from emp table.
->the main inner query find out the max sal that is less
than the sub inner query max sal.
->the sub query result is sent to outer query..

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we do dml on views?

1039


Why should you use or avoid select * statements?

1112


What is self contained sub query?

1141


What are the different SQL Server Versions you have worked on?

1080


What are the kinds of subquery?

1109


Is it possible to have clustered index on separate drive from original table location?

1041


What is sql server query analyzer?

1131


What are wait types?

1251


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

1040


Explain system functions or built-in functions? What are different types of system functions?

1067


How to remove duplicate rows from table except one?

1091


explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

1134


Can you index views?

955


How do I create a trace in sql server?

1121


How raid can influence database performance?

1119