Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DB2 :: Getting sum on Totals and Adjusted totals

$
0
0
Author: balaji81_k
Subject: Getting sum on Totals and Adjusted totals
Posted: Fri Mar 24, 2017 7:51 pm (GMT 5.5)

Hi Team ,
I am looking to get the sum of sales amount by store and district . Certain district allows some adjustment in their totals. I need to include the logic to know actual sum of Net_Sales_amt + adjusted Net sales_amt by Store and Dist .
Totals = Actual totals + Adjusted Totals .

Code:

SELECT STORE_NBR,STORE_TYPE,DIST_NBR,
CASE WHEN DISTRICT = 10 OR DISTRICT  = 11
      THEN ROUND(SALES_AMT * 100  * 1.013,0)
     WHEN DISTRICT = 12 OR DISTRICT =  13
       THEN ROUND(SALES_AMT * 100 * 1.016,0)
ELSE
        ROUND(SALES_AMT*100,0)
END AS ADJUSTED_SALES_TOTAL
FROM SALES_STORE
WHERE DEPT_NBR  <> 10
AND STORE_TYPE  IN(P,T)
AND SALES_POST_DATE = CURRENT DATE
GROUP BY STORE_NBR, STORE_TYPE,DIST_NBR
WITH UR 
 


Can any one help me to get me to the Totals Sum = Actuals + Adjsuted?
_________________
dear peoples,
i want to join these this group in order to
enrich my knowledge in mainframe.


Viewing all articles
Browse latest Browse all 8500

Trending Articles