Link to home
Start Free TrialLog in
Avatar of casstd
casstd

asked on

SQL SUM Function. Sum the column value to get Grand Total. If one of the column having null value then it does not return the SUM value i.e. The GrandTotal.

Hi,

           I would like to sum up three column value.

ProjectID      GETotal          GMTotal         GOTotal             GrandTotal
10                  1000              <null>             2000                                           ' I don't get sum value here because of null
12                   8000           1000                  500                     9500                

SELECT     SUM(GETotal + GMTotal + GOTotal) AS GrandTotal, ProjectID, GETotal, GOTotal, GMTotal
FROM         dbo.View_EMTOBudget
GROUP BY ProjectID, GETotal, GOTotal, GMTotal

But i have to get 3000 for the ProjectID 10.

How do i do it if some of the column has null value.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of BillAn1
BillAn1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial