title: unpivot() with additional information
body: <p>i have some data like:</p>
  
  <pre><code>t   starttime                 endtime
  
  1   2012-11-13 07:00:00.000   2012-11-13 09:00:00.000
  1   2012-11-13 09:00:00.000   2012-11-13 09:15:00.000
  2   2012-11-13 09:00:00.000   2012-11-13 16:00:00.000
  1   2012-11-13 09:15:00.000   2012-11-13 12:00:00.000
  1   2012-11-13 12:30:00.000   2012-11-13 15:00:00.000
  1   2012-11-14 07:00:00.000   2012-11-14 09:00:00.000
  1   2012-11-14 09:00:00.000   2012-11-14 09:15:00.000
  1   2012-11-14 09:15:00.000   2012-11-14 12:00:00.000
  1   2012-11-14 12:30:00.000   2012-11-14 15:00:00.000
  1   2012-11-15 07:00:00.000   2012-11-15 09:00:00.000
  1   2012-11-15 09:00:00.000   2012-11-15 09:15:00.000
  1   2012-11-15 09:15:00.000   2012-11-15 12:00:00.000
  1   2012-11-15 12:30:00.000   2012-11-15 15:00:00.000
  </code></pre>
  
  <p>and want to get it preprcessed like:</p>
  
  <pre><code>timestamp               t   x
  
  2012-11-13 07:00:00.000 1   1
  2012-11-13 09:00:00.000 1   0
  2012-11-13 09:00:00.000 1   1
  2012-11-13 09:00:00.000 2   1
  2012-11-13 09:15:00.000 1   0
  2012-11-13 09:15:00.000 1   1
  2012-11-13 12:00:00.000 1   0
  2012-11-13 12:30:00.000 1   1
  2012-11-13 15:00:00.000 1   0
  2012-11-13 16:00:00.000 2   0
  2012-11-14 07:00:00.000 1   1
  2012-11-14 09:00:00.000 1   0
  2012-11-14 09:00:00.000 1   1
  2012-11-14 09:15:00.000 1   0
  2012-11-14 09:15:00.000 1   1
  2012-11-14 12:00:00.000 1   0
  2012-11-14 12:30:00.000 1   1
  2012-11-14 15:00:00.000 1   0
  2012-11-15 07:00:00.000 1   1
  2012-11-15 09:00:00.000 1   0
  2012-11-15 09:00:00.000 1   1
  2012-11-15 09:15:00.000 1   0
  2012-11-15 09:15:00.000 1   1
  2012-11-15 12:00:00.000 1   0
  2012-11-15 12:30:00.000 1   1
  2012-11-15 15:00:00.000 1   0
  </code></pre>
  
  <p><code>x</code> should define, if value of <code>timestamp</code> is from <code>starttime</code> ( x = 1 ) or from <code>endtime</code> ( x = 0 ).
  i know, it's piece of cake, using two <code>selects</code> with an <code>union all</code>.</p>
  
  <p>but i'm wondering <strong>if it is possible using <code>unpivot()</code></strong> with some extensions?
  started like:</p>
  
  <pre><code>SELECT 
      , UD."timeStamp"
      , UD."t"
      , "isStart"
  FROM 
      (
          SELECT 
                "StartTime"
              , "EndTime"
              , "t"
              , &lt; REFERENCE TO STARTTIME OR ENDTIME ? &gt;
          FROM 
              Data 
      ) AS BC
  UNPIVOT ( "timeStamp" FOR dummy IN ( "StartTime", "EndTime" )) AS UD
  </code></pre>
  
  <p><code>&lt; REFERENCE TO STARTTIME OR ENDTIME ? &gt;</code> should give the information, from which column timeStamp comes from...</p>