Re: MySQL Conditional Trigger

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux