Query to get max and second max in oracle in one query ?
Answer Posted / ajit
select max(sal),1 no
from emp
union
select sal,rn from (select sal,rownum rn from emp)
where rn = 2
order by 1 desc;
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can we store images in oracle database?
How to create a testing table in oracle?
How to convert characters to dates in oracle?
How do I use os authentication with weblogic jdriver for oracle and connection pools?
What are the limitations of check constraint?
What is a select query statement in oracle?
How to insert a record into a table?
What is a nested table and how is it different from a normal table?
What are the oracle differences between nvl and coalesce
How to list all user accounts in oracle?
What is a cursor variable?
How to create a server parameter file?
When do you get a .pll extension in oracle? Explain its importance
What is the relation of a user account and a schema in oracle?
If youre unsure in which script a sys or system-owned object is created, but you know its in a script from a specific directory, what UNIX command from that directory structure can you run to find your answer?