You need to use the COALESCE function in PostgreSQL http://developer.postgresql.org/pgdocs/postgres/functions-conditional.html
Essentially you need to tell SQL how to handle NULLs. i.e. When NULL return 0.
You need to use the COALESCE function in PostgreSQL http://developer.postgresql.org/pgdocs/postgres/functions-conditional.html
Essentially you need to tell SQL how to handle NULLs. i.e. When NULL return 0.