Bug #39970 | count distinct reports zero | ||
---|---|---|---|
Submitted: | 10 Oct 2008 9:37 | Modified: | 16 Oct 2008 11:00 |
Reporter: | Finotello Andrea | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S2 (Serious) |
Version: | 5.0.51a, 4.1, 5.0, 5.1, 6.0 bzr | OS: | Any (Linux, MS WindowsW2K3 community edition) |
Assigned to: | CPU Architecture: | Any | |
Tags: | COUNT DISTINCT |
[10 Oct 2008 9:37]
Finotello Andrea
[10 Oct 2008 10:59]
Sveta Smirnova
Thank you for the report. Verified as described. Workaround: select count(distinct id,ifnull(longfk,0)) as tot from test_count; Probably documentation issue as COUNT counts not null values only and not clear how it should work in such case.
[16 Oct 2008 11:00]
Sergei Golubchik
Sveta already explained why it's not a bug. She forgot to add that COUNT(DISTINCT a,b,c)) is the same as COUNT(DISTINCT CONCAT(a,b,c)).