Return to the SQL Tips
Coalesce Function instead if IFNULL
The IfNull function is not ANSI standard, but the Coalesce function is.
This example shows how to supply a value when the SalesRep.Name column is null. The Coalesce function takes two or more arguments and returns the first non-null argument (or null if all arguments are null).
Select Customer.CustId, Customer.Name As "Customer Name", Coalesce( SalesRep.Name, 'Not assigned' ) As "Sales Rep Name" From Customer Left Outer Join SalesRep On Customer.CustId = SalesRep.CustId
[report a broken link by clicking here]