Query to get max and second max in oracle in one query ?
Answer Posted / sumit wadhwa
select distinct(a.colname) from table a where &n=(select
count(distinct(b.colname)) from table b where
a.colname<=b.colname);
from this query u can find out Nth MAX in a one query
eg
select distinct(a.sal) from emp a where &n=(select count
(distinct(b.sal)) from emp b where a.sal<=b.sal);
Is This Answer Correct ? | 55 Yes | 16 No |
Post New Answer View All Answers
What is the dynamic sql in oracle?
hi friends i completed b.com 2004.i have 3y accounting exp. in manufacturing company.now i have completed oracle finance.pls suggest me how will get job in oracle.can i get job in oracle.
Whats the benefit of dbms_stats over analyze?
Explain about achiever in sql?
What is bind variable in oracle 11g?
Write a syntax for update query in oracle?
What is an oracle table?
Please explain drop constraint oracle?
Explain the use of analyse option in exp command.
What happens to the current transaction if the session is killed?
What is the Tune Query
What is an oracle database table?
How to set up autotrace for a user account?
How to unlock the sample user account in oracle?
How to check the server version in oracle?