Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Summarize the total by category - forum topic by MMM

$
0
0

I get the full data for each category instead of getting the full total for each category. For example the output came out 9936 instead of 5 rows with totals
SELECT
 SV.CATEGORY_DSC,
 SUM(SV.BILL_UNIT_CNT) BILL_UNIT_CNT,
 SUM(SV.BILL_DAY_CNT) BILL_DAY_CNT,
 SUM(SV.BILL_AMT)BILL_AMT
 FROM EDWMTH.CL_BILL_MTL SV,
     EDWMTH.CL_SUMM_MTL SM
WHERE SV.PAID_IND = 'Y' AND SV.CATEGORY_DSC <>'Unknown'
      AND SV.CL_JOIN_KEY = SM.CL_JOIN_KEY AND SM.CL_PAID_IND = 'Y'
   AND SV.BILL_BEG_DT >= '2009-01-01' AND SV.BILL_BEG_DT <= '2009-01-31'
GROUP BY
 SV.CATEGORY_DSC,
 SV.BILL_UNIT_CNT,
 SV.BILL_DAY_CNT,
 SV.BILL_AMT
ORDER BY 1
 ;
 

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>