title: Dynamic Query in MySQL
body: <p>I have a following table.</p>
  
  <pre><code>/------------------------------------\
  | LocID | Year | Birth | Death | Abc |
  |------------------------------------|
  |  1    | 2011 | 100   | 60    | 10  |
  |------------------------------------|
  |  1    | 2012 | 98    | 70    | 20  |
  |.....                               |
  \------------------------------------/
  </code></pre>
  
  <p>I need the output to be (Condition LocID = 1)</p>
  
  <pre><code>/---------------------\
  | Event | 2011 | 2012 |
  |---------------------|
  | Birth |  100 |  98  |
  |---------------------|
  | Death |  60  |  70  |
  |---------------------|
  | Abc   |  10  |  20  |
  \---------------------/
  </code></pre>
  
  <p>The table may contain more fields based on various requirements... Hence the number of Rows will depend upon the number of fields (ignoring LOCID and YEAR). Columns is constant.
  Only for 2 years (Year will be given For ex 2012 is given, then need to display 2011 and 2012). </p>
  
  <p>Essentially need to make column name as row values and column value as Column heading...</p>
  
  <p>Any help....</p>