title: How to do a GroupBy statement with ServiceStack OrmLite
body: <p>I am doing some queries for Data Visualization and rely on GroupBy, Avg, Sum, and similar functions to get a good dataset from the DB.</p>
  
  <p>I would like to use something similar to GroupBy with ServiceStack OrmLite.  On the <a href="https://github.com/ServiceStack/ServiceStack.OrmLite/blob/master/tests/ServiceStack.OrmLite.Tests/ShippersExample.cs" rel="nofollow">ShippersExample page</a> I see the following query.  Is there an easier or better way to do this?  </p>
  
  <p>For example, I have a 'location' column and would like to find the top 5 locations of an entry, and list these locations with the amount of times it occurs.  I only have 1 table, so no need for joins.</p>
  
  <pre><code>    var rows = db.SqlList&lt;ShipperTypeCount&gt;(
         "SELECT {0}, COUNT(*) AS Total 
         FROM Shippers 
         GROUP BY {0} 
         ORDER BY Total".Fmt("ShipperTypeId".SqlColumn()));
  </code></pre>