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

Not Adding Up

Status
Not open for further replies.

LaCour

MIS
Jul 15, 2004
53
0
0
US
In the select statment, I am trying to add up multiple fields and alias their sum as a new field.

Here is a shorter simple example of my ugly fields names:

Select (projects.[field1]+projects.[field2]+projects.[field3]) AS [A Sum]
From projects

The field "A Sum" is coming back blank. Any suggestions?

FYI: I am not trying to do an agregate sum here ... I am trying to

Thanks
Blair
 
Code:
Select (projects.[field1]+projects.[field2]+projects.[field3]) AS 'A Sum'
From projects


Skip,
[sub]
[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue][/sub]
 
... AS [A Sum] is correct

i bet one of the values is null

:)

try this:
Code:
select nz([field1],0)
     + nz([field2],0)
     + nz([field3],0) as [A non-null sum]
  from projects

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top