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 / sivanandam

SELECT ID,MAX(SALARY) FROM EMP
WHERE SALARY < SELECT MAX(SALARY) FROM EMP

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to insert and update data into a table with "insert" and "update" statements?

504


Can we use pragma autonomous_transaction in trigger?

533


What is candidate key with example?

505


How will you optimize a stored procedure optimization?

503


What is filter index?

513






Is it possible in sql table to have more than one foreign key?

606


What is ddl command?

526


Would you store your query in a ssrs report or a database server? State the reason why?

108


What are the two authentication modes in sql server?

596


how can you select rexcord(rows) from table A which is not present in Table B . Id being the FK in Table B referencing to ID Table A

1212


How to Update from select query in sql server?

537


How to convert a table data in XML format in sql server?

2113


Beginning with sql server version 7 0, a new enhanced data type nchar was added what type of data is supported with this data type?

507


What is meant by indexing?

501


What are the key configuration files for sql server reporting services ?

120