Query to get max and second max in oracle in one query ?
Answer Posted / sarmistha mohanty
select * from (
select SAL,
row_number() over (partition by 1 order by SAL DESC)
as rank
from <table name> ) where rank in (1,2)
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Explain an exception and its types?
Why should I use oracle database?
How to create a new table by selecting rows from another table?
How to get a list of all background sessions in the database?
Explain the use of constraints option in exp command.
How to export your connection information to a file?
What are joins, explain all types of joins?
Explain the difference between sap and oracle?
Give syntax for SQL and ORACLE joins.
How to check the oracle tns settings?
is there a tool to trace queries, like profiler for sql server?
Explain compound trigger in oracle?
How to get maxsal , minsal, ename department wise in single query
What is the purpose of save points in oracle database?
Explain the different normalization forms?