title: SELECT * FROM multiple tables, group by ID
body: <p><strong>purpose</strong>: I have been tasked with exporting a complex dataset from a PHP counseling appointment webapp, and convert it into an excel file containing student data sorted by their <code>STUDENT_ID</code>.</p>
  
  <p>I have 3 MySQL tables containing data. They all have a <code>STUDENT_ID</code> field. </p>
  
  <p>I need to make a query which retrieves all the data from the 4 tables, grouping into a single row based on <code>STUDENT_ID</code>.</p>
  
  <p>Some of the tables contain multiple entries for the same <code>STUDENT_ID</code>. If possible I'd like these multiple entries combined into a single row (so that each unique <code>STUDENT_ID</code> is on one line).</p>
  
  <p>This is what I have so far but it doesn't seem to work how I expect it to.</p>
  
  <pre><code>SELECT *
  from ssp_student t1
  INNER JOIN ssp_student_quarterly t2 
  ON t1.STUDENT_ID = t2.STUDENT_ID 
  INNER JOIN ssp_weekly_progress t3 
  ON t2.STUDENT_ID = t3.STUDENT_ID
  GROUP BY t1.STUDENT_ID
  </code></pre>
  
  <p>Table Schema:</p>
  
  <pre><code>Table 1: 
  | STUDENT_ID | PEER_COACH_ID | ACTIVE | COHORT | WEEKLY_MEETING_TIME | FYE_ID | RC | AGREEMENT_SIGNED | RELEASE_SIGNED | NOTES | FACULTY_ADVISOR |
  
  Table 2:
  | STUDENT_ID | QUARTER | COUNSELLING_OFFICE | WRITING_CENTER | CASE_MANAGEMENT | SSP_SOCIAL_EVENTS | SSP_SUCCESS_SEMINAR | HOME_SUPPORT | ACCOMODATION_USED | DISCOVERY_PATHWAYS | PEER_COACHING |
  
  Table 3:
  | STUDENT_ID | QUARTER | WEEK | EMAIL_INTERACTION | PHONE_INTERACTION | TEXT_INTERACTION | INPERSON_INTERACTION | SOCIAL_INTERACTION | NUMBER_OF_SOCIAL_INTERACTIONS | CASE_MANAGEMENT_INTERACTIONS | NUMBER_OF_CASE_mANAGEMENT_INTERACTIONS | SUCCESS_SEMINAR_INTERACTION | NUMBER_OF_SUCCESS_SEMINAR_INTERACTIONS | OTHER_INTERACTION | THEMES | SURVEY_ID | NOTES |
  </code></pre>
  
  <hr>
  
  <p><strong>what I need:</strong> I want 1 row for each <code>STUDENT_ID</code>, which contains columns for all the data associated with that <code>STUDENT_ID</code> in tables 1, 2 and 3. </p>