> Does this seem right?
> druid=> SELECT client_id, SUM(tramount)
> FROM acctrans GROUP BY client_id;
> client_id|sum
> ---------+---
> |
> (1 row)
> If there are no rows in the table then shouldn't the result be no rows
> when GROUP BY is used? Further, What about this?
Not sure. Someone may want to try this query on another DB. I know the
answer to the next one though...
> druid=> SELECT SUM(tramount) FROM acctrans;
> sum
> ---
>
> (1 row)
> Shouldn't that be 0.00?
No. It is returning NULL, because NULL means "don't know". It doesn't
mean "nothing" or "zero". That is certainly the correct behavior if the
table were populated with all NULLs in that column. And by extension, it
is the correct result if there are no rows at all, since "don't know"
for a bunch should give the same result as "don't know" for a few or for
none.
> What will the NUMERIC or DECIMAL types do in these situations? It
> looks like INTEGER has the same behaviour as MONEY (which tramount
> is.)
They will all behave the same.
- Tom