title: Transposing rows to column ORACLE SQL
body: <p>I created this ORACLE SQL query that gives me all the data I need:  </p>
  
  <pre><code>SELECT ci.record_no,
           ci.communication_no,
           ctt.description AS "TOPIC",
           ctc.description AS "CATEGORY",
           cc.sequence_no
      FROM communication_instance ci,
           communication_category cc,
           ct_category ctc,
           ct_topic ctt,
           ct_type ctp,
           department d,
           communication_record cr
     WHERE     ci.record_no = cc.record_no
           AND ci.record_no = cr.record_no
           AND cc.topic = ctc.topic
           AND cc.topic = ctt.code
           AND cc.category = ctc.category
           AND ci.communication_type = ctp.code
           AND ci.creator_department = d.code
           AND ci.record_no = '1565852'
  ORDER BY 2  
  </code></pre>
  
  <p>The data output looks like this:  </p>
  
  <blockquote>
    <h3>|RECORD_NO | COMMUNICATION_NO | TOPIC | CATEGORY | SEQUENCE_NO|</h3>
  
  <pre><code>  1565852             1           Inter     Stat          1   
    1565852             1           Clien     Call          2   
    1565852             2           Inter     Stat          1   
    1565852             2           Clien     Call          2   
    1565852             3           Inter     Stat          1   
    1565852             3           Clien     Call          2  
  </code></pre>
  </blockquote>
  
  <p>Please note the following relationships:</p>
  
  <ul>
  <li>1 <code>communication_no</code> is 1 instance of the <code>record_no</code> (ie. there should only be 3 <code>communication_no</code> rows)</li>
  <li>For every unique <code>record_no</code>, there can be multiple <code>sequence_no</code>'s</li>
  <li>Since multiple <code>sequence_no</code>'s can exist for a single <code>record_no</code>, each <code>communication_no</code> would have 1 &amp; 2 as their <code>sequence_no</code>'s</li>
  </ul>
  
  <p>I am trying to get the data to display the 3 unique <code>communcation_no</code> records, and have the <code>topic</code>, <code>category</code> and <code>sequence_no</code>'s displayed in separate columns (instead of by rows). So the columns would become:</p>
  
  <blockquote>
    <ul>
    <li><strong>RECORD_NO</strong>  </li>
    <li><strong>COMMUNICATION_NO</strong>  </li>
    <li><strong>TOPIC_1</strong>  </li>
    <li><strong>CATEGORY_1</strong>  </li>
    <li><strong>SEQUENCE_NO_1</strong>  </li>
    <li><strong>TOPIC_2</strong>  </li>
    <li><strong>CATEGORY_2</strong>  </li>
    <li><strong>SEQUENCE_NO_2</strong>    </li>
    </ul>
  </blockquote>
  
  <p>For example, <code>communication_no</code> = 1, would have 1 row and the fields would be (in order):</p>
  
  <blockquote>
    <ul>
    <li>1565852  </li>
    <li>1  </li>
    <li>Inter  </li>
    <li>Stat  </li>
    <li>1</li>
    <li>Clien  </li>
    <li>Stat  </li>
    <li>2 </li>
    </ul>
  </blockquote>
  
  <p>Is this possible?</p>