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

How to sum up the columns total value in the last row - response (7) by dnoeth

$
0
0
Select case when grouping(LOB) = 1 then '' else LOB end,
case when grouping(CMPGN_NAME) = 1 then '' else CMPGN_NAME end,
case when grouping(INC_TRXN_CD) = 1 then 'TOTAL' else INC_TRXN_CD end,
sum ( INC_AMT ) as TOTAL_DOLLAR_AMT , count (*) as TOTAL_ACCTS
from UD466.FF_PRCSS where Elg_Flg='Y'
group by grouping sets ((LOB,CMPGN_NAME,INC_TRXN_CD), ())
order by grouping(LOB), LOB, grouping(CMPGN_NAME), CMPGN_NAME, grouping(INC_TRXN_CD), INC_TRXN_CD

 
Dieter


Viewing all articles
Browse latest Browse all 27759

Trending Articles