title: Can I write this query using the criteria API or am I stuck with HQL?
body: <p>I have the following query which I would like to write using the criteria api of NH.</p>
  
  <pre><code>select status, count(1) from (select distinct Status, post_id from post_statistics) tbl group by status
  </code></pre>
  
  <p>each post_id can exist multiple times in post_statistics</p>
  
  <p>e.g.</p>
  
  <p>id post_id status
  1  1       open
  1  1       edit
  1  1       open
  1  2       open</p>
  
  <p>so the query should return the following results:</p>
  
  <p>status  count
  open    2
  edit    1</p>
  
  <p>thx in advance.</p>