title: MySQL JOIN multiple query result to 1 result set
body: <p>I want to join multiple result sets to 1 result on one key.</p>
  
  <p>There is 3 tables ( i add here only relevant records):</p>
  
  <pre><code>Project table : | id | project |
  
  File table    : | id | project_id |
  
  Approved table: | file_id | dep1_date | dep2_date | dep3_date |
  </code></pre>
  
  <p>The departments default is a date string: 0000-00-00 00:00:00
  The first query is:</p>
  
  <pre><code>SELECT project.project, 
  SEC_TO_TIME(AVG(TIME_TO_SEC(TIMEDIFF(approved.dep1_date,file.uploaded_datetime)))) as dep1_avg
  FROM APPROVED
  LEFT JOIN file on file.id = approved.file_id
  LEFT JOIN project on project.id=file.project_id
  WHERE approved.dep1_date != '0000-00-00 00:00:00'
  GROUP BY project.project
  </code></pre>
  
  <p>It will give me the approval times average groupped as projects etc.:</p>
  
  <pre><code>Project    Dep1_avg
  project1   01:03:02
  project2   04:14:03
  project3   00:07:56
  ...
  </code></pre>
  
  <p>I want to run this query 2 more times with dep2 and dep3_date too, and attach to the first result set, but contains different WHERE statament (approved.dep2_date, approved.dep3_date).</p>
  
  <p>How can it be done to look the table this?</p>
  
  <pre><code>Project    Dep1_avg Dep2_avg Dep3_avg
  project1   01:03:02          04:23:11
  project2   04:14:03 11:33:44
  project3   00:07:56 00:13:43 32:24:17
  ...
  </code></pre>
  
  <p>The 2 more result is grupped same as the first query(by projects), and if no approval on one project for etc Dep2 or Dep3 it shouls be NULL or empty</p>
  
  <p>What the query looks?</p>
  
  <p>Thanks</p>