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!

SUM without Group By - newbie

718446Aug 20 2009 — edited Aug 20 2009
I have the following query. The results are below

SELECT CODE, Sum((PURCHASE_QUANTITY * UNIT_COST)*(SPLIT_PERCENT/100))AS TOTAL, ITEM_DESC

FROM CAPITAL
INNER JOIN SPLIT ON (OUTLAY.ELEMENT = SPLIT.ELEMENT)

GROUP BY OUTLAY.CODE, ITEM_DESC


60 97 desc1
60 82 desc2
60 47 desc3
60 12 desc4
61 10 desc5
61 58 desc6
62 14 desc7
62 80 desc8

What I want is

60 123 desc1
61 13245 desc2
62 1234 desc3


Adding the description to the group by is not allowing the totals to rollup but instead is showing the detailed cost per code. Is there a way around this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 17 2009
Added on Aug 20 2009
3 comments
729 views