Try this:
select COALESCE(sum(balance),0) from mytable where customer="john"
This should do the work. The coalesce method should return the 0.
Try this:
select COALESCE(sum(balance),0) from mytable where customer="john"
This should do the work. The coalesce method should return the 0.