mysql> SELECT product_id,if(isnull(price)=0,'A','B') as p from products;
---------
mysql> SELECT product_id,isnull(price) as p from products;
+------------+---+
| product_id | p |
+------------+---+
| 1 | 0 |
| 2 | 0 |
| 3 | 0 |
+------------+---+
3 rows in set (0.00 sec)
mysql> SELECT IF(NULL = NULL, 1, 3);
+-----------------------+
| IF(NULL = NULL, 1, 3) |
+-----------------------+
| 3 |
+-----------------------+
1 row in set (0.00 sec)
mysql> SELECT IF(NULL is NULL, 1, 3);
+------------------------+
| IF(NULL is NULL, 1, 3) |
+------------------------+
| 1 |
+------------------------+
No hay comentarios:
Publicar un comentario