title: How can I aggregate data from multiple rows into a single one spread across multiple columns?
body: <p>I have this table in my database and I want to aggregate data from multiple rows into a single one spread across multiple columns: </p>
  
  <pre>
  ID     PID        date              time
  1      12         10/04/2014        7:00
  2      12         10/04/2014        10:00
  3      12         10/04/2014        15:00
  4      13         10/04/2014        7:00
  5      13         10/04/2014        15:00
  6      12         11/04/2014        7:20
  7      12         11/04/2014        15:10
  8      13         11/04/2014        7:10
  9      13         11/04/2014        7:50
  10     13         11/04/2014        15:00
  11     13         11/04/2014        15:50
  </pre>
  
  <p>PID is the employee ID, to be specific it's an attendance system. 
  I need to extract this format and insert this form in another table: </p>
  
  <pre>
  ID      PID      date               time1          time2         time3       time4
  1       12       10/04/2014         7:00           10:00         15:00
  2       13       10/04/2014         7:00           15:00
  3       12       11/04/2014         7:20           15:10
  4       13       11/04/2014         7:10           7:50          15:00       15:50   
  </pre>