title: JPQL with subquery to select max count
body: <p>I'm trying to write a jpql query to select the user with the most comments. If two users have the same number of comments I want to select both.</p>
  
  <p>I tried this, something like this:</p>
  
  <pre><code>SELECT
    c.user, COUNT(c.id) as commentCount 
  FROM 
    Comment c
  WHERE
    commentCount = (SELECT MAX(SIZE(user.comments)) FROM User user)
  GROUP BY 
    c.user
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>SELECT
    c.user
  FROM 
    Comment c
  GROUP BY 
    c.user
  HAVING
    COUNT(c) = (SELECT MAX(SIZE(user.comments)) FROM User user)
  </code></pre>
  
  <p>Neither approach works. What do I need to do here?</p>