title: Mysql Query to display row data as columns
body: <p>I need to display summary of data stored in a MySQL database table </p>
  
  <p>control_point_run       </p>
  
  <pre><code>run_date    control_point   duration
  10/10/2016  A   100
  10/10/2016  B   200
  10/10/2016  C   150
  10/11/2016  A   160
  10/11/2016  B   220
  10/11/2016  C   180
  10/12/2016  A   200
  10/12/2016  B   120
  10/12/2016  C   180
  </code></pre>
  
  <p>expected output </p>
  
  <pre><code>run_date    A   B   C
  10/10/2016  100 200 150
  10/11/2016  160 220 180
  10/12/2016  200 120 180
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/FOtG5.png" rel="nofollow noreferrer">Requirement image</a>
  Please help me with MySQL query to get the expected result. I have no idea how to convert row data in to column headings [A,B,C]. </p>
  
  <p>Please note, the expected column names (A,B,C) need to be automatically generated based on the available data. the table contains more data than in this sample and more control_point values can be inserted in the future as well.</p>