title: Group records by range
body: <p>I need to select a count of items that fall into some range like this </p>
  
  <pre><code>create table numbers (val int);
  
  insert into numbers(val) values (2), (3), (11), (12), (13), (31);
  
  select count(1) as qty , val / 10 as range
  from numbers
  group by val / 10;
  </code></pre>
  
  <p>Obviously, if there're no items in range, it won't be included in the output. I could think of some inelegant ways to include all ranges in the output, but is there an elegant and fast one (in PostgreSQL or MS SQL Server dialect)</p>