Re: Query to total

From: The Magnet <art_at_unsu.com>
Date: Fri, 20 May 2011 08:52:26 -0700 (PDT)
Message-ID: <8a5687f7-6844-47c2-940b-2da804e21080_at_z19g2000yqz.googlegroups.com>



On May 20, 4:36�am, HeadLessBoot <headl..._at_seattle.us.maybe> wrote:
> HeadLessBoot, on 05/20/2011 11:33 AM, wrote:
>
> > SELECT � �*
>
> <CUT>
>
> > � �, (
> > � � � � � SELECT SUM(NUMERICFIELD3) FROM THE_VIEW
> > � � � � � ) AS TOTAL3
> > � �, (
> > � � � � � SELECT SUM(NUMERICFIELD4) FROM THE_VIEW
> > � � � � � ) AS TOTAL4
>
> Sorry, I obviously forgot to end it all with
> FROM DUAL
Well, this is working. But it does not have what I need. You see by my original query that certain columns have a different set of criteria, which I am not sure how to integrate into this query:

SELECT DECODE(group_name,NULL,'TOTAL',group_name) group_name, sales, provider_fee, authorize_fee, partner_fee, 0 credit_card_fee FROM (SELECT group_name, SUM(order_quantity * price) sales, SUM(royalty * price / 100) provider_fee, SUM(0.1) authorize_fee, SUM(rate * price / 100) partner_fee

          FROM reports.newsletter_report nr, reports.product_groups pg
          WHERE pg.newsletter_id = nr.newsletter_id
             AND nr.date_entered >= SYSDATE - 2
             AND nr.date_entered <  SYSDATE
             AND nr.transaction_id <> -1
             AND nr.transaction_id IS NOT NULL
          GROUP BY CUBE (pg.group_name));
Received on Fri May 20 2011 - 10:52:26 CDT

Original text of this message