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.
Posted on 2004-09-16
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
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.