title: Add time between 2 dates across multiple rows in SQL Server
body: <p>I have a table that lists all users for my company. There are multiple entries for each staff member showing how they have been employed.</p>
  
  <pre><code>RowID   UserID  FirstName   LastName    Title      StartDate    Active  EndDate
  -----------------------------------------------------------------------------------
  1       1       John        Smith       Manager    2017-01-01   0       2017-01-31 
  2       1       John        Smith       Director   2017-02-01   0       2017-02-28 
  3       1       John        Smith       CEO        2017-03-01   1       NULL
  4       2       Sam         Davey       Manager    2017-01-01   0       2017-02-28 
  5       2       Sam         Davey       Manager    2017-03-01   0       NULL
  6       3       Hugh        Holland     Admin      2017-02-01   1       NULL
  7       4       David       Smith       Admin      2017-01-01   0       2017-02-28
  </code></pre>
  
  <p>I am trying to write a query that will tell me someones length of service at any given time.</p>
  
  <p>The part I am having trouble with is as a single person is represented by multiple rows as their information changes over time I need combine multiple rows...</p>
  
  <p>I have a query to report on who is employed at a point in time which is as far as I have gotten.</p>
  
  <pre><code>DECLARE @DateCheck datetime 
  SET @DateCheck = '2017/05/10'
  
  SELECT * 
  FROM UsersTest
  WHERE @DateCheck &gt;= StartDate AND @DateCheck &lt;= ISNULL(EndDate, @DateCheck)
  </code></pre>