title: How can I join multiple SQL tables using the IDs?
body: <p>I have 4 different tables that I want to join. The tables are structured with columns as follows:</p>
  
  <pre><code>TableA - aID | nameA | dID
  
  TableB - bID | nameB | cID | aID
  
  TableC - cID | nameC | date
  
  TableD - dID | nameD
  </code></pre>
  
  <p>Starting with Table A, I understand how to JOIN tables a and c using b, since b has the Primary Keys for those tables. I want to be able to join table TableD on TableA as well. Below is my SQL statement that first joins tables A and B, then joins that to C:</p>
  
  <pre><code>SELECT TableA.*, TableB.*, TableC.* FROM (TableB INNER JOIN TableA
  ON TableB.aID= TableA.aID)
  INNER JOIN TableC ON(TableB.cID= Tablec.cID)
  WHERE (DATE(TableC.date)=date(now())) 
  </code></pre>
  
  <p>When I attempt to add another join, to include D, I get an error that 'TableD' is unknown:</p>
  
  <pre><code> SELECT TableA.*, TableB.*, TableC.*, TableD.* FROM (TableB INNER JOIN TableA
      ON TableB.aID= TableA.aID)
      INNER JOIN TableC ON(TableB.cID= Tablec.cID)
      INNER JOIN TableA ta ON(ta.dID= TableD.dID)
      WHERE (DATE(TableC.date)=date(now())) 
  </code></pre>