Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Addition in SQL

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hey Guys,

I wanted to add three sums to get a Grand Total.

Here's the dilemma : If any of hte three sums is null, then the GrandTotal sum turns out to be Null as well.
so 4033+3333 +null = null

here's my query: Can anyone help me find the some irrespective of null fields? tks.

""
SELECT ApplicationName, Sum([Amount $]) AS SumOfAmount, Sum(LLR) AS SumOfLLR, Sum([CAD $]) AS SumOfCAD, SumOfAmount + SumOfLLR + SumOfCAD AS TotalSum FROM [TableMain-2]
""

All Help Appreciated. Tks

 
Try including the function nz([amount]). the "NZ" changes all null values to zero.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top