title: SQL statement unique ID and then grouping by unique ID and counting a distinct other ID group
body: <p>I want to make a query that makes the unique ID concatenate and then group by this unique ID and then count another field by distinct. I get the output but the count is off. I verified through another source.</p>
  
  <pre><code>SELECT 
      CONCAT(x, y, z, a) AS 'uniqueid',
      COUNT(DISTINCT id) AS 'count'
  FROM bv
  GROUP BY
      x, y, z, a
  </code></pre>