Query to get max and second max in oracle in one query ?

Answer Posted / samir kumar sahoo

SELECT sal FROM(SELECT DISTINCT(sal) FROM employees ORDER
BY sal DESC) WHERE ROWNUM<=2;

Is This Answer Correct ?    23 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an oracle recycle bin?

551


Explain the use of record option in exp command.

537


Explain the use of full option in exp command.

589


How many anonymous blocks can be defined?

586


Give syntax for SQL and ORACLE joins.

636






Are truncate and delete commands same? If so why?

654


What is merge statement used for?

570


What is coalesce function?

575


How to open a cursor variable?

611


what is IDE,DMV in sql server?

2248


How to create a table interactively?

562


11. Display the client number and name and the client number and name of the person who referred that client.

1921


How to import one table back from a dump file?

597


How to insert a record into a table?

642


What is a synonym? What are its various types?

623