I\'m trying to sum up Customer balances using the following query:
select sum(balance) from mytable where customer = \'john\'
However, if
Maybe you are thinking of COUNT's behaviours?
COUNT
COUNT(Field) will return 0 but SUM(Field) returns NULL if there are no matching rows.
COUNT(Field)
0
SUM(Field)
NULL
You need an ISNULL or COALESCE
ISNULL
COALESCE
COALESCE or ISNULL