$IFNULL
$IFNULL specifies a return value for columns that contain null values.
The column data type and the return value data type must match.
If column-value is NULL then return specified-value, else return column-value
Use
of this function could change the results of a calculated average. A true
NULL is generally not included in a count and thus not included in an
average. A NULL altered with this function will be included in the count
and the average.
Syntax
$IFNULL(column, specified-value)
column
Required. Column name that might contain a null value.
specified-value
Required. The value to return if the column value is null. This value
must be of the same data type as the column.
Example
select company,
$IFNULL(contact,
'No contact')
from customers
where state = 'ca'
Top
|