avjoshi
IS-IT--Management
- May 12, 2003
- 221
Hi Guys,
This is quiet puzzling scenario. I'm creating a table using a sql statement (create table as select...). When I compare the results from that table against the sql statement that created it I get different results.
I am stumped. May be I am making some stupid mistake but I'm kinda of bleary eyed looking at that statement for last three hours. Just wanted a second pair of eyes to look at my script.
Thanks,
Anand.
Here's my code that creates the table,
And here's the comparision
Anand
This is quiet puzzling scenario. I'm creating a table using a sql statement (create table as select...). When I compare the results from that table against the sql statement that created it I get different results.
I am stumped. May be I am making some stupid mistake but I'm kinda of bleary eyed looking at that statement for last three hours. Just wanted a second pair of eyes to look at my script.
Thanks,
Anand.
Here's my code that creates the table,
Code:
create table STG_AGG_FACT_TFMIL_SHARE_OF_TF
AS
SELECT db.SBA_CODE, MARKET_CENTER_CODE,
MARKET_SEGMENT,DIVISION,
REGION,BROKER,PLANTO,
DAY_KEY, PACK_GROUP_CODE,
SUM(REVISED_PLANNED_AMT) REVISED_PLANNED_AMT,
SUM(TRADE_PAYMENT_AMT) TRADE_PAYMENT_AMT
FROM AGG_FACT_TFM_ALLC_AMTS f, DIM_PACK_GROUP dp, DIM_PLANTO_CUSTOMER_MV db
WHERE dp.PACK_GROUP_KEY = f.PACK_GROUP_KEY
AND db.PLANTO_CUST_NBR = f.PLANTO_CUST_NBR
GROUP BY db.SBA_CODE,MARKET_CENTER_CODE,MARKET_SEGMENT,DIVISION,REGION,BROKER,PLANTO,
DAY_KEY, PACK_GROUP_CODE;
And here's the comparision
Code:
SQL> SELECT SUM(REVISED_PLANNED_AMT) REVISED_PLANNED_AMT,
SUM(TRADE_PAYMENT_AMT) TRADE_PAYMENT_AMT
FROM AGG_FACT_TFM_ALLC_AMTS f, DIM_PACK_GROUP dp, DIM_PLANTO_CUSTOMER_MV db
WHERE dp.PACK_GROUP_KEY = f.PACK_GROUP_KEY
AND db.PLANTO_CUST_NBR = f.PLANTO_CUST_NBR;
REVISED_PLANNED_AMT TRADE_PAYMENT_AMT
------------------- -----------------
702349420 615989901
1 row selected.
SQL> SELECT SUM(REVISED_PLANNED_AMT) REVISED_PLANNED_AMT,
SUM(TRADE_PAYMENT_AMT) TRADE_PAYMENT_AMT
FROM jmsstage.STG_AGG_FACT_TFMIL_SHARE_OF_TF;
REVISED_PLANNED_AMT TRADE_PAYMENT_AMT
------------------- -----------------
49051010.6 615116975
1 row selected.
SQL>
Anand