title: Complex Self-Join
body: <p>I have a problem with a view, I'm working with Sql Server.
  I have a table like this:</p>
  
  <pre><code>+-------+------+
  | Start | End  |
  +-------+------+
  |     1 | Null |
  |     3 | 4    |
  |     6 | 9    |
  +-------+------+
  </code></pre>
  
  <p>This table represents a series of timeframe, if End is Null this means that it has not finished, but there may be short breaks (3-4 and 6-9), I would like to create a view that will show all the timeframes like this:</p>
  
  <pre><code>+-------+------+
  | Start | End  |
  +-------+------+
  |     1 | 3    |
  |     3 | 4    |
  |     4 | 6    |
  |     6 | 9    |
  |     9 | Null |
  +-------+------+
  </code></pre>
  
  <p>I can't find a solution. I tried more than than an hour with no results.</p>