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