Re: sqlplus compute sum subtotal
- From: Michael Moore <michaeljmoore@xxxxxxxxx>
- To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
- Date: Wed, 14 Apr 2010 16:43:04 -0700
SELECT ccd.cg_category_group_name, f.acct_key, sum(f.invoice_amt)
FROM workorder_fact f JOIN class_category_dim ccd ON
ccd.cc_class_cat_sid = f.class_cat_sid
GROUP BY ROLLUP (ccd.cg_category_group_name, f.acct_key);
--Mike
On Wed, Apr 14, 2010 at 3:12 PM, Ron Crisco <ron.crisco@xxxxxxxxxxxx> wrote:
> If I understand your question, then the problem is not with your report
> formatting, but with your SQL. Does this SQL give the answer you want?
>
> SELECT ccd.cg_category_group_name,
>
> sum( f.invoice_amt) "Total Invoice Amt"
>
> FROM workorder_fact f, class_category_dim ccd
>
> WHERE
>
> ccd.CC_CLASS_CAT_SID=f.CLASS_CAT_SID
>
> group by
>
> ccd.cg_category_group_name
>
>
>
>
> Ron Crisco
>
> On Wed, Apr 14, 2010 at 4:54 PM, Barbara Baker <barb.baker@xxxxxxxxx>wrote:
>
>> Oracle 9.2.0.7 on linux
>>
>> I thought this should be simple (and perhaps, indeed, it is), but I’m not
>> getting it.
>>
>>
>>
>> I want a sum of the invoice amount when the category changes.
>>
>> e.g., I don’t want the individual account details;
>>
>> I just want a total for LEGAL, a total for RENTALS, etc.
>>
>>
>>
>> Any help??
>>
>> thanks! Barb
>>
>>
>>
Other related posts: