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 / elumalai.k

select top1 id,salary from employee
where
(salary<(select max (salary) As sal from employee As Empp))
orderby salary desc.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an active database?

610


What are the restraints imposed on the table design by a merge replication?

583


How you can add messages to the nt event log from within a stored procedure?

583


What is the difference between ddl and dml?

578


What is the difference between a fill factor of 100 and 0?

542






What are the triggers in sql?

565


What is plan freezing?

591


how would you improve etl (extract, transform, load) throughput?

556


What is save transaction and save point?

630


What security features are available for stored procedure?

601


Explain the first normal form(1nf)?

569


What is a trigger and types of a trigger?

577


How do I view views in sql server?

527


Can a database be shrunk to 0 bytes, if not, why?

650


How to recompile stored procedure at run time?

575