title: SQL Server 2012 Query to extract subsets of data
body: <p>I'm trying to 2nf some data:</p>
  
  <pre><code>Refid | Reason
  ------|---------
  1     | Admission
  1     | Advice and Support
  1     | Behaviour
  </code></pre>
  
  <p>As you can see one person might have multiple reasons so i need another table to have the following format:</p>
  
  <pre><code>Refid | Reason1   | Reason2            | Reason3     |  ETC...
  ------|-----------|--------------------|-----------
  1     | Admission | Advice and Support | Behaviour
  </code></pre>
  
  <p>But I don't know how to write a query to extract the data and write it in a new table like this. The reasons don't have dates of other criteria that would make any reason to be in any special order. All reasons are assigned at the time of referral.</p>
  
  <p>Thanks For yor Help..  SQL Server 2012</p>