Subject | CASE statement Question |
---|---|
Author | Tanz Anthrox |
Post date | 2003-11-03T14:51:34Z |
I have problems with NULL fields.
SELECT Code, Sum(Amount) from TableA
the problem if the AMOUNT is NULL then SUM field is NULL. But I need the Value ZERO (0)
I tried to format it
SELECT Code, SUM(CASE Amount WHEN NULL THEN 0 else Amount) from TableA
But this is not working. I tried to use IF..THEN..ELSE But it was also failure for me.
I think this is well known problem for newbies, So I need your help for solving it.
Regards
[Non-text portions of this message have been removed]
SELECT Code, Sum(Amount) from TableA
the problem if the AMOUNT is NULL then SUM field is NULL. But I need the Value ZERO (0)
I tried to format it
SELECT Code, SUM(CASE Amount WHEN NULL THEN 0 else Amount) from TableA
But this is not working. I tried to use IF..THEN..ELSE But it was also failure for me.
I think this is well known problem for newbies, So I need your help for solving it.
Regards
[Non-text portions of this message have been removed]