Re: MySQL Conditional Trigger

From: Date: Sun, 21 Dec 2008 21:33:03 +0000
Subject: Re: MySQL Conditional Trigger
References: 1 2 3 4 5 6 7  Groups: php.db 
Request: Send a blank email to php-db+get-45821@lists.php.net to get a copy of this message
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/

« previous php.db (#45821) next »