title: Left join multiple tables onto one table
body: <p>I want to left join multiple tables to one table. The tables are themselves results of subqueries.  </p>
  
  <p>A classical example that comes to my mind is, I have a bunch of subqueries:<br>
  1. Subquery A gives me details of students  - say table 1<br>
  2. Subquery B gives me student scores in Math  - say table 2<br>
  3. Subquery C gives me student scores in English  - say table 3<br>
  The tables contain scores only if the student has taken that test and the student is to be considered failed if he/she has not taken test at all (or has a score &lt; passing score). I have student IDs (unique per person) in each table to join on.</p>
  
  <p>What do I want from these?  I am trying to build a dynamic query (where some parts are populated at runtime by an external mechanism) by performing some joins on these tables to give me:<br>
  1. Students who passed in both tests and corresponding scores<br>
  2. Students passed in either test, but failed (or did not take) the other test and the corresponding scores (NULL if not taken).
  3. All students and their corresponding scores.</p>
  
  <p>What I have on mind is left joining <strong>each</strong> score table <strong>to student profile table</strong>.  How should I go about this?</p>
  
  <p>Before you go ahead and suggest <code>table 1 left join table 2 left join table 3</code>, this structure will cause problems if, say table 2 contains a null record for a particular student (as per my knowledge). And this basically joins table 3 on table 2 and not on table 1, from my understanding, which is what I want.</p>
  
  <p>PS: Feel free to suggest better ways to get what I need, if you know any.</p>