Jak przekonwertować NULL, aby unosić się w mysql
SELECT COALESCE(col, 0) FROM `table`;
Matteoweb
SELECT COALESCE(col, 0) FROM `table`;
+------------------+
| COALESCE(col, 0) |
+------------------+
| 100 |
| 0 |
| 300 |
| 0 |
+------------------+
4 rows in set (0.00 sec)
CREATE TABLE `table` (id int, col int);
INSERT INTO `table` VALUES (1, 100);
INSERT INTO `table` VALUES (2, NULL);
INSERT INTO `table` VALUES (3, 300);
INSERT INTO `table` VALUES (4, NULL);