title: 3 Table JOIN - With two unique Identifiers Pulling different data from the third
body: <p>I have two tables containing dyamic data, both reference a third static table for a description. Imagine this scenario:</p>
  
  <pre><code>Cake Table
  Sponge Table
  Description Table
  </code></pre>
  
  <p>A Sponge is a type of Cake. Each instance of a sponge belongs to an instance of a Cake. Basically, a Sponge has a Cake ID associated with it.</p>
  
  <p>A Cake has a base description that fits the style of the cake. This is a simple numbered index. ie. Cake description might be 25, which in turn equals to "Soft, yet Squeezable", in the Description Table.</p>
  
  <p>Cake Table Rows have an index of their Description. Likewise, a Sponge also has an index of it's description - even if it is the same as the description as the cake.</p>
  
  <p>A sponge belongs to a Cake with Description ID 25 - the Cake is "Soft, yet Squeezable"; but the Sponge also has it's own description index 10 - "Almondy with a less of a bite!".</p>
  
  <p>My question is, how do I pull both descriptions from the third table? It's probably quite simple but I've been working on this for ages trying to come out with a query that works</p>
  
  <p>So far:</p>
  
  <pre><code> SELECT 
      cakes.*,
      sponges.*, 
      descriptions.description as cake_description,
      descriptions.description as sponge_description
           from sponges
               join cakes on cake_id = sponge_id
           join descriptions on cake_desc_id = description_id
  </code></pre>
  
  <p>The above duplicates the Sponge Description in both description fields. Basically, I want to be able to pull Cake Description, and Sponge Description - at the same time.</p>
  
  <p>Thanks in advance for any help</p>