Subject Re: [ib-support] SUM + row_count
Author Tomislav Avramovic
You'r wrong Helen
From: "Helen Borrie" <helebor@...>
> Select
> sum("Col_1") as Total,
> count("Col_1") AS answer
> where "col_2" = '2'
> and "Col_1" is not null;
>
> -- solves the problem. In this case, count ("Col_1") and count(*) would
> deliver the same set.

If some rows have NULL Col_1, sum("Col_1") sums only not null rows

Select sum("Col_1"), count("Col_1") from T where "col_2" = '2' and "Col_1"
is not null;

is equal to

Select sum("Col_1"), count("Col_1") from T where "col_2" = '2';