Hi Dieter,
First of all thank you very much for the reply. It worked fine. But i am getting
REFDB.A.EX_QTY does not exists. i ran the query like below
SELECT 'UNKNOWN' , 'UNKNOWN' , 0 , - 999 ,
C.BR_PARTY_KEY ,
'UNKNOWN' ,
/* SUM ( A.EX_QTY ) ,
SUM ( CAST( A.LIST_PRICE_AMT AS DOUBLE PRECISION ) ) ,
SUM ( CAST( A.NET_PRICE_AMT AS DOUBLE PRECISION ) ) ,
SUM ( CAST( A.COST_AMT AS DOUBLE PRECISION ) ) , */
'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'N' , 'UNKNOWN' ,
'N' , 'N' , 'N'
FROM
(
SELECT
CUST_KEY,
SUM ( A.EX_QTY ) AS EX_QTY,
SUM ( CAST( A.LIST_PRICE_AMT AS DOUBLE PRECISION ) ) AS LIST_PRICE_AMT,
SUM ( CAST( A.NET_PRICE_AMT AS DOUBLE PRECISION ) ) AS NET_PRICE_AMT,
SUM ( CAST( A.COST_AMT AS DOUBLE PRECISION ) ) AS COST_AMT
FROM ORDDB.BKGS A
WHERE a.ser_flag = 'N'
GROUP BY 1
) A,
REFDB.CUST_PARTY C
WHERE A.CUST_KEY = C.CUST_KEY
GROUP BY C.BR_PARTY_KEY
80% of the Cost is reduced.
Thanks once again,
Harshitha.
↧