title: How to Group property in Order Clause using Grails Criteria
body: <p>i am using Grails Criteria to pull results for a specific domaini want to ask whether is it possible to have group property in order clause or in other words, how can i write following mysql query  using Grails criteria ?</p>
  
  <pre><code>select 
         h.name,
         count(h.id) 
  from my_table as h 
  group by h.name 
  order by count(h.id) desc;
  </code></pre>
  
  <p>so far grails criteria query looks like </p>
  
  <pre><code>def results =  MyObject.createCriteria().list{
  
   projections{
       groupProperty('name')
       countDistinct('id')
  
    }
     order(???,'desc')
  }
  </code></pre>
  
  <p>Thanks in advance
  Rehman</p>