title: Store row values as new column before group by
body: <p>Anyone know how I can group by, but keep a distinct column? I messed around with UNPIVOT but couldnt find a good explanation to help me write my code. Anyone have a solution?</p>
  
  <p>I have data that looks like this:</p>
  
  <pre><code>acct contact email phone
  1     44      abc  NULL
  1     33      NULL 123
  2     2       xxx  NULL
  2     22      NULL 456
  </code></pre>
  
  <p>I use </p>
  
  <pre><code>select acct,max(email) as email, max(phone) as phone from my_table 
  group by acct
  </code></pre>
  
  <p>to wind up with this:</p>
  
  <pre><code>acct email phone
  1    abc 123
  2    xxx  456
  </code></pre>
  
  <p>but my end goal is to group by and create a separate contact column for phone and email like this:</p>
  
  <pre><code>acct contact_email email phone contact_phone
  1     44           abc  123    33
  2     2            xxx  456    22
  </code></pre>