title: Are Case statements the answer
body: <p>I have multiple rows of data for each call that I'm trying to track. The data looks like this</p>
  
  <pre><code>Call_ID | site | Agent_key | starttime | exit_reason
  ----------------------------------------------------
  1234     |   7   |           |     1     | transfer
  1234     |   3   |  1010101  |     15    | transfer
  1234     |   7   |  2121212  |     302   | transfer
  1234     |   5   |  3232323  |     680   | transfer
  </code></pre>
  
  <p>I want to create a column called say "first_site". The parameters are site when starttime is min(starttime) and Agent_key is not null. (if Agent_key is null it means the call is still in a call center system so I don't care what site is represented there.</p>
  
  <p>the result would look like</p>
  
  <pre><code>Call_ID | site | Agent_key | starttime | exit_reason | first_site |
  -------------------------------------------------------------------
  1234     |   7   |           |     1     | transfer    |      3     |
  1234     |   3   |  1010101  |     15    | transfer    |      3     |
  1234     |   7   |  2121212  |     302   | transfer    |      3     |
  1234     |   5   |  3232323  |     680   | transfer    |      3     |
  </code></pre>
  
  <p>Any advice would be appreciated!</p>