title: Custom SQL Query to Count by Range or Group
body: <p>In this example, how do I return the count of employees by salary band using SQL?</p>
  
  <pre><code>Table : EmployeeSalary
  Employee Salary
  1        21,000
  2        24,000
  3        30,000
  4        31,000
  5        32,000
  6        50,000
  
  Table: SalaryBands
  ID Name  MinSalary MaxSalary
  1  Tier1 20,000    24,999
  2  Tier2 25,000    44,999
  3  Tier3 45,000    150,000
  </code></pre>