How to sum up totals from different columns and insert into one column

Database
Enthusiast

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  

2 REPLIES
Enthusiast

Re: How to sum up totals from different columns and insert into one column

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.

Enthusiast

Re: How to sum up totals from different columns and insert into one column

thanks Raja K Thaw. works well.