Re: SQLPLUS MIND BENDER
Date: Fri, 4 Jun 1993 14:35:28 GMT
Message-ID: <1993Jun4.143528.3264_at_news.unomaha.edu>
fgreene_at_hayes.com writes:
>
>
> COCOA
>
> ALPHA ALPHA BRAVO BRAVO BRAVO-ALPHA
> XDATE QTY TOTAL QTY TOTAL VARIANCE
>
> 03-JUN-93 0 0 25 25 25
> O4-JUN-93 20 20 0 25 5
> 05-JUN-93 30 50 0 25 -25
> 06-JUN-93 25 75 30 55 -20
> 07-JUN-93 0 75 40 95 20
> 08-JUN-93 20 95 35 130 35
> 10-JUN-93 10 105 0 130 25
>
CREATE TABLE <table_name>
AS
(SELECT xdate, alpha_qty, alpha_total, null bravo_qty, null bravo_total,
b.bravo_total - a.alpha_total variance
FROM alpha_table a, bravo_table b
WHERE a.xdate = b.xdate
UNION
SELECT xdate, null alpha_qty, null alpha_total, bravo_qty, bravo_total,
d.bravo_total - c.alpha_total variance
FROM alpha_table c, bravo_table d
WHERE c.xdate = b.xdate);
Not sure if this is something you already have thought about ... you can change the null statements to nvl(x,0) ... or something like that.
Mike. Received on Fri Jun 04 1993 - 16:35:28 CEST