title: Grouping records between start and end time
body: <p>I have a database of tests, each with a StartTime and (for those finished) EndTime value.
  I want to create a query that would display the number of tests that were running each hour.</p>
  
  <p>i.e. Tests that had a startTime but not an EndTime at any given hour.</p>
  
  <p>I worked out the grouping thing  - with thanks to <a href="https://stackoverflow.com/a/7001787/467473">this answer</a> from <a href="https://stackoverflow.com/users/23199/p-campbell">@p.cambell</a> to the question <a href="https://stackoverflow.com/questions/7001718/sql-server-group-by-count-of-datetime-per-hour">SQL Server Group by Count of DateTime Per Hour?</a></p>