title: Should I be using a LEFT JOIN, RIGHT JOIN with derived tables, a different table design, or need to code?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7674786/mysql-pivot-table">MySQL pivot table</a>  </p>
  </blockquote>
  
  
  
  <p>Should I be using a <em>LEFT JOIN using derived tables</em>, a <em>RIGHT JOIN using derived tables</em>, a different table design, or do I need to query the table and write Python code to produce the desired output shown below?</p>
  
  <p>The output I would like to get to would yield the following output example:</p>
  
  <pre><code>==========================
  | 2005   |  2006 |  2007 |  &lt;--- These headings are not necessary
  ==========================
  |   A    |  A    |  A    |
  --------------------------
  |  AA    |  AA   |  AA   |
  --------------------------
  |  BB    |  BB   |       |
  --------------------------
  |  C     |       |   C   |
  --------------------------
  </code></pre>
  
  <p>The data for the query is in a two column table containing (symbol, year):</p>
  
  <pre><code>====================
  |  Symbol |  Year  |
  ====================
  |   A     |  2005  |
  --------------------
  |   AA    |  2005  |
  --------------------
  |   BB    |  2005  |
  --------------------
  |   C     |  2005  |
  --------------------
  |   A     |  2006  |
  --------------------
  |   AA    |  2006  |
  --------------------
  |   BB    |  2006  |
  --------------------
  |   A     |  2007  |
  --------------------
  |   AA    |  2007  |
  --------------------
  |   C     |  2007  |
  --------------------
  </code></pre>