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!

Summary and Details in same query

426372Feb 8 2005 — edited Feb 8 2005
Hey all,
Boss man wants me to figure out how to do this and I'm stumped. Simplified, imagine I have four departments, each with sales data. He wants to see a report of sales by dpt by month and the total for the month at the bottom. He also wants it in a single SQL statement. ie:
Query Output:
Month   Dpt   Sales
OCT     A1    $1000
OCT     B1    $500
OCT     C1    $300
OCT     D1    $1700
OCT     ALL   $3500
NOV     A1    $900
NOV     B1    $700
NOV     C1    $400
NOV     D1    $1200
NOV     ALL   $3200
...

TABLES

DPT
---------
DPT_ID
DPT_NAME

SALES
---------
SALE_ID
DPT_ID
AMT
SALEDATE
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2005
Added on Feb 8 2005
5 comments
235 views