All Forums Database
amadu 14 posts Joined 09/14
02 Oct 2014
How to sum up totals from different columns and insert into one column

 How to rsum up totals from different columns and insert into one column
Hi there,
I have created a column to hold the total amounts for all amounts types recorded against an event.
the insert statements worked well for all the columns.
what i want to do is to rollup the total amounts for the 9 columns below and insert into the new column (CUST_TOTAL_AMT).
 ,S5IE_ADJ_TOT_AMT                      INTEGER
 ,S5IE_DEDN_MAINT_EXPEND_AMT  INTEGER
 ,S5IE_FGN_INC_AMT                      INTEGER
 ,S5IE_FRNG_BEN_AMT                    INTEGER
 ,S5IE_NET_INV_LOSS_AMT             INTEGER
 ,S5IE_RPT_SUPER_CONTRIB_AMT    INTEGER 
 ,S5IE_TAX_FREE_PENR_BEN_AMT    INTEGER 
 ,S5IE_TAXEXE_FGN_INC_AMT          INTEGER
 ,S5IE_6MTH_INC_AMT                     INTEGER 
 , CUST_TOTAL_AMT                         INTEGER  
 
 
Below is sample of the insert statement that works well for the 9 columns above?
  , ...
  , CAST(S5IE.S5IE_ADJ_TOT_AMT AS DECIMAL(15,2))/100 AS ADJ_TOT_AMT
  , etc
  , etc
Best Regards  

Amadu Barrie
Raja_KT 1246 posts Joined 07/09
02 Oct 2014

I am not sure if I understand it correctly. I think this is what you want:
.....
(S5IE_ADJ_TOT_AMT+S5IE_DEDN_MAINT_EXPEND_AMT +S5IE_FGN_INC_AMT+S5IE_FRNG_BEN_AMT ........) as summing,
Please let me know if this is what you want.

Raja K Thaw
My wiki: http://en.wikipedia.org/wiki/User:Kt_raj1
Street Children suffer not by their fault. We can help them if we want.

amadu 14 posts Joined 09/14
02 Oct 2014

thanks Raja K Thaw. works well.

Amadu Barrie

You must sign in to leave a comment.