title: MySQL COUNT(DISTINCT()) unexpected results
body: <p>I'm using MySQL 5.0.45 on CentOS 5.1.</p>
  
  <p><code>SELECT DISTINCT(email) FROM newsletter</code></p>
  
  <p>Returns 217259 rows</p>
  
  <p><code>SELECT COUNT(DISTINCT(email)) FROM newsletter</code></p>
  
  <p>Returns 180698 for the count.</p>
  
  <p><code>SELECT COUNT(*) FROM (SELECT DISTINCT(email) FROM newsletter) AS foo</code></p>
  
  <p>Returns 180698 for the count.</p>
  
  <p>Shouldn't all 3 queries return the same value?</p>
  
  <p>Here is the schema of the newsletter table</p>
  
  <pre>
  CREATE TABLE `newsletter` (
    `newsID` int(11) NOT NULL auto_increment,
    `email` varchar(128) NOT NULL default '',
    `newsletter` varchar(8) NOT NULL default '',
    PRIMARY KEY  (`newsID`)
  ) ENGINE=MyISAM;
  </pre>
  
  <p><strong>Update:</strong> I've found that if I add a <codE>WHERE</code> clause to the first query then I get the correct results. The <codE>WHERE</code> clause is such that it will not effect the results.</p>
  
  <p><code>SELECT DISTINCT(email) FROM newsletter WHERE newsID > 0</code></p>