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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Sum's

Status
Not open for further replies.

yakdogs

Programmer
Aug 13, 2002
40
US
I am really new to SQL. I have two colums that I am doing a summary on then adding the two sums together to come up with a balance. Problem, if one sum is blank it does not add across to the balance.

How do I do this?

I have listed below an sample I have been playing with.

SUM(dbo.vwLiens.Balance)AS Lien_Balance,
SUM(dbo.vwPayment_Summary.PayAmount)AS Payment_Balance,
dbo.vwLiens.Balance - dbo.vwPayment_Summary.PayAmount AS Balance

Any help is greatly appreciated.
 
SUM(IsNull(dbo.vwLiens.Balance,0)AS Lien_Balance,
SUM(IsNull(dbo.vwPayment_Summary.PayAmount,0)AS Payment_Balance,


Thanks

J. Kusch
 
Thank you so much. I knew it had to do with ISNULL but did not know how to write it.

Have a great day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top