Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Get max of sum(col)

450482Dec 4 2007 — edited Dec 5 2007
Hi
select col1, sum(col2) as sm
from
(huge complex query)


How can I select the max(sm) along with col1? Other than using the following method:
select col, sum(col2) as sm from (<huge query>) where
sum(col2) = (select max(sm) from <huge complex query>)

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 2 2008
Added on Dec 4 2007
14 comments
21,461 views