sum columns in same row
I have the requirement to find the sum of a number of fields in one data row.
In short I have the following:
The issue I have is if one of the fields is null the query fails. How can I get around this?
SELECT Seq01 + Seq02+Seq03+Seq04 as ItemSum FROM Tablename
Any help would be great.
Does "NULL" have special meaning for the fields? In other words, did you really mean to use NULL, or is a default value of 0 more appropriate?
thanks for your reply.
The fields would be "empty" of data.
Out of curiosity, but why do you have to sum across fields? I'm not saying that this is always wrong, but it tends to be a sign of poor relational database design, e.g., you have numbered fields that should have been separated into rows of a different table.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)