title: postgresql : extract(epoch function over multiple rows
body: <p>I am using postgresql 8.3 (no choice in the version at this time)</p>
  
  <p>My raw data is as follows:</p>
  
  <pre><code>ID | From  | To    | Time
  01 | n/a   | open  | 06:56
  01 | open  | pt1   | 07:56 
  01 | pt1   | pt2   | 07:59 
  01 | pt2   | pt3   | 08:36 
  01 | pt3   | pt4   | 08:56  
  01 | pt4   | close | 09:58
  </code></pre>
  
  <p>What I want to end up with is:</p>
  
  <pre><code>ID | Open_Time | Close_Time
  01 | 06:56     | 09:58
  </code></pre>
  
  <p>I don't care about the time intervals between the individual parts.  I have  many ID numbers and each can have this or more are part intervals to it.  I'm fairly new to sql so I am pretty lost here.  I'm stuck on how to merge the two end and beginning rows into one row in a new view.  </p>