No problem. Email is a very confusing thing. ;-)
-dhs
Dean H. Saxe, CISSP, CEH
[EMAIL PROTECTED]
"[T]he people can always be brought to the bidding of the leaders.
This is easy. All you have to do is to tell them they are being
attacked, and denounce the pacifists for lack of patriotism a
Dean,I asked the RDBMS question because I was going to offer a Stored Procedure solution if he was using MS SQL Server 2000 or 2005.I understand your point. I will endeavor to ask my questions in a better way so that readers do not make assumptions of my intended meaning.
Sorry for the perceived c
All RDBMS will require the columns not in the aggregate function in
the group by clause.
-dhs
Dean H. Saxe, CISSP, CEH
[EMAIL PROTECTED]
"What is objectionable, what is dangerous about extremists is not
that they are extreme, but that they are intolerant."
-- Robert F. Kennedy, 1964
What RDBMS are you using?TeddyOn 9/22/06, Chris C. Cooper <[EMAIL PROTECTED]> wrote:
The problem I had with this is if I did this...SELECT sum(column_name,column_name2, column_name3) as sum_value FROM Table
GroupBy column_nameIt wanted the additional column names to be in the group by--
The problem I had with this is if I did this...
SELECT sum(column_name,column_name2, column_name3) as sum_value FROM Table
GroupBy column_name
It wanted the additional column names to be in the group by
-
Chris C. Cooper
Cooper e.Business Solutions
Atlanta
Thanks, you are correct about still
getting the NULL value as the total. This is the solutions here…
SELECT mySum = ISNULL(col1, 0) +
ISNULL(col2, 0) + ISNULL(col3, 0)
-
Chris C. Cooper
Cooper e.Business Solutions
Atlanta, Georgi
This solution worked the best, letting the
database do the work. I just can not get the SUM function to work correctly,
but this is a nice work around.
THANKS!
Try SELECT value1 + value2 + value3 as daSum FROM yourtable
DK
On 9/21/06, Chris C.
Cooper <
[EMAIL PROTECTED
To
answer the first question, you can get rid of the "" problem
with:
If the
var is null or empty, Val() will change it to 0
If you
want to accomplish the same via SQL, try:
SELECT
mySum = ISNULL(col1, 0) + ISNULL(col2, 0) + ISNULL(col3,
0)
If you
try to add columns together and an