title: Oracle 11g - Merging single column duplicates to create a vertical summary
body: <p>Does anybody know how to remove and merge duplicates based on a single column of a multi-column table to create a 'vertical summary'.</p>
  
  <p>I.E) Trying to build Table B from Table A</p>
  
  <pre><code>Table A:
  Person Language
  Bob    English
  Sarah  French
  John   Chinese
  Bob    French
  Sarah  English
  Sarah  Chinese
  
  Table B (RESULT): 
  Person English French Chinese 
  Bob       Y       Y     (null)
  Sarah     Y       Y       Y
  John      (null)  (null)  Y
  </code></pre>
  
  <p>How I was thinking originally of doing it was:
  Creating Table A from the data and then doing the following:</p>
  
  <pre><code>Create table summary as 
  Select person, (case when language = 'English' then 'Y') as English, (case when        language = 'French' then 'Y') as French, (case when language = 'Chinese' then 'Y') as  Chinese
  From Table A;
  </code></pre>
  
  <p>Finally doing a select distinct of the summary table. 
  The logic is however wrong, especially because distinct does so across all columns, but I only want distinct people names. </p>
  
  <p>The other option I was thinking of in my head was Creating a table populated with only the distinct names of people and empty columns English, French and Chinese. Then using an update statement to populate them via matching to Table A.</p>
  
  <p>Does anybody know a better way / how I could implement this. I'm still in the earlier stages of learning Oracle (especially regarding looping) and any help would be greatly appreciated.</p>
  
  <p>Thanks! </p>