title: MySQL COUNT() GROUP BY doesn't work
body: <p>I have a problem in counting by <strong>MySQL</strong> in a <code>GROUP BY</code>
  This is the query that does not return the desired result.</p>
  
  <pre><code>SELECT COUNT(bagno)
  FROM disposizione_assegnazione_pezze
  JOIN pezze 
    ON pezza = id
  WHERE id_prodotto_tessuto = 12096
    AND id_collezione = 11 
    AND id_stagione = 22 
    AND id_tema = 1
  GROUP BY bagno
  </code></pre>
  
  <p>The result of the count is <strong>3</strong></p>
  
  <p>This is the <code>pezza</code> table and its primary key is <code>id</code></p>
  
  <p><a href="https://i.stack.imgur.com/3BZL7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3BZL7.png" alt="Table pezza with results"></a></p>
  
  <p>This is the table <code>disposizione_assegnazione_pezze</code> that has the <code>pezza</code> column which refers to the previous table</p>
  
  <p><a href="https://i.stack.imgur.com/vHub4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vHub4.png" alt="Table disposizione_assegnazione_pezze"></a></p>
  
  <p>Why does not return <strong>1</strong> as a result my query?</p>
  
  <hr>
  
  <h2>Question of the problem</h2>
  
  <p>I want to count how many different <code>bagno</code> are there</p>