calculate days with gaps
<p>table:</p>

<pre>
+-----------+--------------+------------+------------+
| RequestID | RequestStaus | StartDate  |  EndDate   |
+-----------+--------------+------------+------------+
|         1 | pending      | 9/1/2015   | 10/2/2015  |
|         1 | in progress  | 10/2/2015  | 10/20/2015 |
|         1 | completed    | 10/20/2015 | 11/3/2015  |
|         1 | reopened     | 11/3/2015  | null       |
|         2 | pending      | 9/5/2015   | 9/7/2015   |
|         2 | in progress  | 9/7/2015   | 9/25/2015  |
|         2 | completed    | 9/25/2015  | 10/7/2015  |
|         2 | reopened     | 10/10/2015 | 10/16/2015 |
|         2 | completed    | 10/16/2015 | null       |
+-----------+--------------+------------+------------+
</pre>

<p>I would like to calculate the days opened but exclude the days between completed and reopened. For example, RequestID 1, the days opened will be (11/3/2015 - 9/1/2015) + (GetDate() - 11/3/2015), for request 2, the total days will be (10/7/2015 - 9/5/2015) + ( 10/16/2015 - 10/10/2015). </p>

<p>The result I want will be something like:</p>

<pre>
+-----------+-------------------------------+
| RequestID |          DaysOpened           |
+-----------+-------------------------------+
|         1 | 63 + (getdate() - 11/3/2015)  |
|         2 | 38                            |
+-----------+-------------------------------+
</pre>

<p>How do I approach this problem? thank you! </p>