Use IFNULL(column, 0)
to convert the column value to zero.
Alternatively, the COALESCE function will do the same thing: COALESCE(column, 0)
, except
COALESCE
is ANSI-compliant,IFNULL
is notCOALESCE
takes an arbitrary number of columns/values and will return the first non-null value passed to it.