Subject Re: [firebird-support] How to change SUM() result NULL to 0
Author agung wibowo
try this:
select
case
when (sum(field1) is null) then 0
else sum(field1)
end
from table1
group by field2

or this:
select
coalesce(sum(field1),0)
from table1
group by field2

jasajona <jon@...> wrote:

Hello,

How to change SUM() result NULL to 0

-----------------
select
sum(field1)
from
table1
group by
field2
-----------------
So if sum(field1) returns NULL I want to see it as 0.
I tryed many things but no one work (all I get is NULL). Is it FB bug?
I am
using 1.5.1 .




Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/

To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.





---------------------------------
Do you Yahoo!?
Meet the all-new My Yahoo! � Try it today!

[Non-text portions of this message have been removed]