Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> re: Brain F*rt problem solved.

re: Brain F*rt problem solved.

From: Ron Rogers <RROGERS_at_galottery.org>
Date: Thu, 20 Dec 2001 12:11:44 -0800
Message-ID: <F001.003E11F9.20011220115608@fatcity.com>

List
after going in circles all day yesterday and getting the combined looping values in the sum fields
of the query, I arrived refreshed and ready this am. The answer I used was to create a view of the columns wanted from the 2 tables and then use a UNION ALL query on the view to produce the results desired.

View:
 CREATE OR REPLACE VIEW camsview AS
  SELECT a.saledate saledate,

  a.retnbr retnbr,
  a.settlementamt insettle,
  a.returnamt inret,
  a.cashamt     incash,
  a.SALESCOMMAMT  incomm,
  a.CASHBONUSAMT  inbonus,
  to_number(null) olsales,
  to_number(null) olcash,

  to_number(null) olcomm,
  to_number(null) olbonus
  from glciwsr a
  union all
  select b.saledate,
  b.retnbr retnbr,
  to_number(null),
  to_number(null),
  to_number(null),
  to_number(null),
  to_number(null),
  b.salesamt olsales,
  b.cashamt olcash,

  b.salescommamt olcomm,
  b.cashbonusamt olbonus
  from glcowsr b;

query:
set pagesize 60
set linesize 130
break on report
compute sum of insettle inret incash incomm inbonus on report compute sum of olsales olcash olcomm olbonus on report select saledate,
(sum(insettle) - sum(inret)) insettle,

sum(inret) inret,
sum(incash) incash,
sum(incomm)*-1 incomm,
sum(inbonus)*-1 inbonus,
sum(olsales) olsales,
sum(olcash)*-1 olcash,
sum(olcomm)*-1 olcomm,
sum(olbonus)*-1 olbonus

from camsview where
retnbr = &retnbr and
saledate between '&start_dt' and '&end_dt' group by saledate;

Stephane,
Thanks for your input and the direction of a view to solve the problem. Thanks,
Ron
ROR mª¿ªm

--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Ron Rogers
  INET: RROGERS_at_galottery.org

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Thu Dec 20 2001 - 14:11:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US