MySQL Weirdness
I ran across some MySQL weirdness today that bugged me. Basically the counts for the NULL values are being zeroed out. (or not grouped in the first place) Does anyone out there have an explanation?
mysql> select distinct value, count(value) from my_table group by value; +---------------+----------------------+ | value | count(value) | +---------------+----------------------+ | NULL | 0 | | 0 | 121 | | 1 | 321 | +---------------+----------------------+ 3 rows in set (0.02 sec) mysql> select count(1) from my_table +----------+ | count(1) | +----------+ | 4202 | +----------+ 1 row in set (0.00 sec)
Clearly there should be 3,760 NULL values reported, no?








April 28th, 2008 at 2:28 am
I guess that zero is the false value. There’s an error in your page. You must debug it.
November 12th, 2008 at 5:59 pm
qt7o6cya27s592fm