602SQL Documentation Index  


COALESCE ( expression {, expression } )

The COALESCE function returns the value of the first expression that is not NULL. If all expressions are NULL, the function returns NULL. Expressions must have compatible types.


Replace NULL values with a zero constant in the result of an outer join.

SELECT Companies.name,COALESCE(SUM(invoices.price),0)
FROM Companies LEFT OUTER JOIN invoices ON (Companies.cislo=invoices.company)
GROUP BY Companies.name