How consider NULL as the MAX date instead of ignoring it in MySQL?
FYI NULL
is ignored when used in aggregation
function.
mysql> SELECT * FROM null_test;+------+| c |+------+| NULL || 1 || 2 || 3 |+------+4 rows in set (0.00 sec)mysql> SELECT COUNT(c) FROM null_test;+----------+| COUNT(c) |+----------+| 3 | <= not 4 but 3+----------+1 row in set (0.00 sec)mysql> SELECT COUNT(*) FROM null_test;+----------+| COUNT(*) |+----------+| 4 | <= in this case not 3 but 4+----------+1 row in set (0.00 sec)mysql> SELECT AVG(c) FROM null_test;+--------+| AVG(c) |+--------+| 2.0000 | <= not (1+2+3) / 4 but (1+2+3) / 3+--------+1 row in set (0.00 sec)