title: Fetching MySQL data going through multiple tables
body: <p>I'm wanting to do the following:</p>
  
  <p>Select everything from <code>product</code> that matches the value of <code>type_id</code> from both tables <code>product</code> and <code>system_type</code>. Then with <em>those</em> matched results, match <code>cat_id</code> from both tables <code>system_type</code> and <code>system_cat</code> and then refine the final result where <code>cat_type = 0</code> from the <code>system_cat</code> table.</p>
  
  <p>Current SQL seems to have a syntax error:</p>
  
  <pre><code>SELECT * FROM product
  JOIN system_type
      USING (type_id)
  JOIN system_cat
      USING (cat_id)
  WHERE cat_type = 0
  </code></pre>
  
  <p>What else I've tried:</p>
  
  <pre><code>SELECT * FROM product
  JOIN system_type
      USING system_type.type_id = product.type_id
  JOIN system_cat
      USING system_type.cat_id = system_cat.cat_id
  WHERE system_cat.cat_type = 0
  </code></pre>