title: subquery for aggregate and group by
body: <p>Good afternoon, I ran into such a problem and I don’t quite understand how to solve it in the hql query language, I have a request from several parameters that need to be returned all in the answer, I need to aggregate 3 of them,
  I need to group by one of them! for the other two, you just need to get the content. I understand how postgresql works, but I don’t know how to solve this problem, because when grouping, it requires all fields with which mathematical operations have not been performed.</p>
  <pre><code>@Query(&quot;SELECT new value.Value &quot; +
              &quot;(SUM(p.t1), SUM(p.t2), p.t3, SUM(p.t4), p.t5, p.t6) &quot; +
              &quot;FROM P p &quot; +
              &quot;WHERE p.tId = :tId &quot; +
              &quot;GROUP BY p.t6 &quot;)
  </code></pre>
  <p>Maybe I need to do subquery, but I don't know how to do it in HQl</p>