Quantcast
Viewing latest article 2
Browse Latest Browse All 25

SQL SUM STATEMENT HELP

I have 4 tables that contain data. I need to sum table1, table2,table..4  that hold fields.

ID      FinClass      UB      030      060      090      120      150      151
85      CAID      3264.64      19309      22376      5292      1411      4293      229938
86      CAIDHMO      778.44      1493      1141      0      0      620      11723

I need to add the 3 tables the divide by table 4 totals. Not sure the best method,
something like?
SELECT (Sum(artotal.ub)+Sum(bdtotal.ub)+Sum(WRITEOFFTOTAL.ub))/Sum(maintotal.ub) AS ubcalcFROM ARTOTAL INNER JOIN (BDTOTAL INNER JOIN (WRITEOFFTOTAL INNER JOIN MainTotal ON WRITEOFFTOTAL.FinClass = MainTotal.FinClass) ON BDTOTAL.FinClass = WRITEOFFTOTAL.FinClass) ON ARTOTAL.FinClass = BDTOTAL.FinClass group by maintotal.finclass,maintotal.ub;

I need to display the % by finclass

Viewing latest article 2
Browse Latest Browse All 25

Trending Articles