title: two queries give different results in the same database
body: <p>Please help. I'm using MySQL 5.1.30 Community Edition.</p>
  
  <p>I have four tables: nts, operator, country, cooperationtype</p>
  
  <ul>
  <li>table `nts` has one column(`operatorId`) which is a foreign key to column `id` in table `operator` and one column(`voice`) which is a foreign key to column `id` in table cooperationtype</li>
  <li>table operator has one column(`country_id`) which is a foreign key to column (`id`) in table country</li>
  </ul>
  
  <p>I want to get the counts of operators and countries where all of the value of voice not equals to 'N/A' and grouped them by cooperationtype.id with this query:</p>
  
  <p><code>SELECT cooperationtype.id AS cooptype, 
  COUNT(DISTINCT country_id) AS country, COUNT(DISTINCT operatorId) AS operator 
  FROM nts INNER JOIN operator ON operator.id = nts.operatorId INNER JOIN country ON operator.country_id = country.id 
  INNER JOIN cooperationtype ON cooperationtype.id = nts.voice 
  WHERE cooperationtype.code &lt;&gt; 'N/A' GROUP BY cooperationtype.id</code></p>
  
  <p>I got this result:</p>
  
  <pre>
  cooptype   country    operator
  1         128          348
  2         11           11
  3         15           17
  
  </pre>
  
  <p>The sum of this query is 154 countries and 376 operators.</p>
  
  <p>But then when I want to get all of the counts of operators and countries where all of the value of voice not equals to 'N/A', regardless the of cooperationtype.id with this query:</p>
  
  <p><code>SELECT COUNT(DISTINCT country_id) AS country, COUNT(DISTINCT operatorId) AS operator 
  FROM nts INNER JOIN operator ON operator.id = nts.operatorId INNER JOIN country ON operator.country_id = country.id 
  INNER JOIN cooperationtype ON cooperationtype.id = nts.voice 
  WHERE cooperationtype.code &lt;&gt; 'N/A'</code></p>
  
  <p>I got this result:</p>
  
  <pre>
  country operator
  133     372
  </pre>
  
  <p>My questions are:</p>
  
  <ol>
  <li>Why is the sum of the result from the first query doesn't equal to the result from the second query?</li>
  <li>Which one is the right result?</li>
  </ol>
  
  <p>Data example:</p>
  
  <pre><code>voice     country   operator
  1         US        1  
  1         US        2  
  1         UK        3  
  1         UK        4  
  2         US        1  
  2         US        2  
  </code></pre>
  
  <p>For the first query, the data should generate:</p>
  
  <pre><code>cooptype  country   operator 
  1         2         4 
  2         2         2 
  </code></pre>
  
  <p>For the second query, the data should generate:</p>
  
  <pre><code>country   operator 
  2         4 
  </code></pre>