title: HQL and grouping
body: <p>After much problems with using 'group by' in linq2nhibernate, I have tried to switch to HQL, but I am struggeling with a simple example.</p>
  
  <p>I have the following table (ForumThreadRatings):</p>
  
  <p><img src="https://i.stack.imgur.com/rdINo.png" alt="Group by"></p>
  
  <p>I would like to retrieve a list of the highest rated forum threads, which means I need to do a sum with the positive column and a group by the forumthread. I have tried for an example just to do a simple group by in HQL with no luck:</p>
  
  <pre><code>select ftr.ForumThread from ForumThreadRating ftr group by ftr.ForumThread
  </code></pre>
  
  <p>But I receive the following error:</p>
  
  <pre><code>Column 'ForumThreads.Id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
  </code></pre>
  
  <p>What might I be missing?</p>