Re: [PHP-DB] MySQL Conditional Trigger

[email protected] (Chris)
Newsgroups php.db
Message-ID <[email protected]>
Aleksandar Vojnovic wrote:
> You could try with the <> operator.
> !=, <>    Not equal operator

Same issue as using '=':

mysql> select 2 <> null;
+-----------+
| 2 <> null |
+-----------+
|      NULL |
+-----------+
1 row in set (0.00 sec)

Comparing anything with null returns null. (I'm not asking for a 
solution, I'm stating it as fact).

> Or you could try it this way - ISNULL(col_or_data_to_check).
> Example:
> mysql> SELECT ISNULL(1+1);
> +-------------+
> | ISNULL(1+1) |
> +-------------+
> |           0 |
> +-------------+
> 1 row in set (0.02 sec)

You can also use 'coalesce' to set default value for null columns.

http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_coalesce

http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html

-- 
Postgresql & php tutorials
http://www.designmagick.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.