title: Counting number using numbers table with 15 minutes interval
body: <p>What is the most efficient way to count the number of occurrences according?
  I found the numbers table is the most efficient way to generate time sequence data based on start time and end time.
  I have create a number table starts from 0 to 100,000.</p>
  
  <p>I have generate time sequence table as following:</p>
  
  <pre><code>Declare @Start datetime = '2018-01-01 00:00:00.000',@End datetime ='2018-02-01 00:00:00.000';
  
      SELECT
          DATEADD(MINUTE,Number*15,@Start) StartTime,
          [Number],
          DATEADD(MINUTE,(Number+1)*15,@Start) EndTime
      FROM dbo.Numbers 
      Where (Number+1)*15&lt;=DATEDIFF(MINUTE,@Start,@End)
      Order By Number;
  </code></pre>
  
  <p>I have table of data like:</p>
  
  <pre><code>Time                      ID
  2018-01-01 00:00:01.000   1
  2018-01-01 00:00:02.000   1
  2018-01-01 00:15:00.000   124
  2018-01-01 00:28:00.000   341
  2018-01-01 00:26:00.000   111
  2018-01-01 01:02:00.000   162
  2018-01-01 04:09:00.000   110
  2018-01-01 05:09:00.152   398
  2018-01-01 08:12:00.000   902
  2018-01-01 12:45:00.000   009
  2018-01-01 13:23:00.000   000
  2018-01-01 15:37:00.000   187
  </code></pre>
  
  <p>How can I count time based on 15 minutes interval?</p>