title: Split number to ranges in SQL
body: <p>I am trying to write a SQL query that show the distribution of customers seniority since 2015/01/31:</p>
  
  <ol>
  <li>Up to one month</li>
  <li>Between one and six months</li>
  <li>Between six months and one year</li>
  <li>Over a year</li>
  </ol>
  
  <p>I succeeded to split and group the number of months of the customers.</p>
  
  <pre><code>SELECT Seniority, COUNT(Customer_ID) [Number of Customers]
  FROM
  (SELECT Customer_ID,
  DATEDIFF(MONTH, MIN(CONVERT(datetime, Order_Date)), '2015/01/31') Seniority
  FROM Orders
  GROUP BY Customer_ID) t
  GROUP BY Seniority
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/DxLIO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DxLIO.png" alt="enter image description here"></a></p>
  
  <p>How can I split by given ranges?</p>
  
  <p>Expected:</p>
  
  <pre><code>        Seniorty                |   Number of Customers
  Up to one month                 |            0
  Between one and six months      |            14
  Between six months and one year |            1
  Over a year                     |            0
  </code></pre>