Subject | Re: [ib-support] Count value on field |
---|---|
Author | Claudio Valderrama C. |
Post date | 2002-03-21T04:06:50Z |
""Bayu"" <bayu2000@...> wrote in message
news:004301c1d018$3064f600$2c6c053d@bayu01...
functions return NULL is when the whole column is NULL. In contrast, COUNT
never returns NULL. The net result is that in a table with fields A, B & C
that are nullable, the expression
select sum (A + B + C)
gives different results than
select sum (A) + sum (B) + sum (C)
in the general case.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing
news:004301c1d018$3064f600$2c6c053d@bayu01...
> Hello Martin and LucBy design, SUM, AVG, MAX and MIN skip null values. The only case when those
>
> > NULL means the state of 'unknown'.
> >
> > value + unknown = unknown
>
> But why select sum(d_imip) from transaksi will give me the right result ?
functions return NULL is when the whole column is NULL. In contrast, COUNT
never returns NULL. The net result is that in a table with fields A, B & C
that are nullable, the expression
select sum (A + B + C)
gives different results than
select sum (A) + sum (B) + sum (C)
in the general case.
C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing