I have 50 fields that I would like to sum together in an sql statement. However, some of them may be null causing the statement to fail. Can someone send me a statement that would add up only fields that are not null.
My current sql stmt is "select x1 + x2 + x3 + ... x50 from xtable"
Thanksselect ISNULL(x1,0)
+ ISNULL(x2,0)
+ ISNULL(x3,0)
+ ...
+ ISNULL(x50,0) from xtable|||Thanks a lot.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment