title: Getting "#1111 - Invalid use of group function" without using GROUP in MySQL
body: <pre><code>    $qb = $this-&gt;createQueryBuilder('t');
  
      return $qb
          -&gt;join('t.customers', 'c')
          -&gt;where($qb-&gt;expr()-&gt;eq('t.user', $user-&gt;getId()))
          -&gt;andWhere($qb-&gt;expr()-&gt;gt($qb-&gt;expr()-&gt;count('c'), 0))
          -&gt;orderBy('t.name')-&gt;getQuery()-&gt;getResult();
  </code></pre>
  
  <p>The above query (Doctrine2 generated one) is giving me this error:</p>
  
  <blockquote>
    <p><code>#1111 - Invalid use of group function</code></p>
  </blockquote>
  
  <p>but the strange thing is i'm not using <code>GROUP BY</code>. Any help is much appreciated, thanks.</p>
  
  <pre><code>SELECT t0_.id AS id0,
         t0_.slug AS slug1,
         t0_.name AS name2,
         t0_.description AS description3,
         t0_.user_id AS user_id4
  FROM tag t0_ 
      INNER JOIN customers_tags c2_ ON t0_.id = c2_.tag_id
          INNER JOIN customer c1_ ON c1_.id = c2_.customer_id
  WHERE t0_.user_id = 1 AND COUNT(c1_.id) &gt; 0
  ORDER BY t0_.name ASC
  </code></pre>