title: SQL join over five tables
body: <p>I have five tables:</p>
  
  <pre>
  <b>models</b>:             id, name, specification
  <b>models_networks</b>:    id, model_id, network_id
  <b>networks</b>:           id, name, description
  <b>countries_networks</b>: id, country_id, network_id
  <b>countries</b>:          id, countryName, etc, etc
  </pre>
  
  <ul>
  <li>the <code>models</code> table is connected to the <code>networks</code> table via <code>models_networks</code> with a many to many relation.</li>
  <li>the <code>networks</code> table is connected to the <code>countries</code> table via <code>countries_networks</code> with a many to many relation</li>
  </ul>
  
  <p>I need to do the following query, but I'm stuck:</p>
  
  <blockquote>
    <p>Select all the models that will work in a specific country.</p>
  </blockquote>
  
  <p>e.g.: say France has two networks. PigNetwork and CowNetwork. I want to get all the models that work on PigNetwork or CowNetwork, basically any that work in that country one way or the other.</p>
  
  <p>If I've made myself clear, can someone help with the JOIN query please? I've only ever gone as far as joining two tables before. Thanks.</p>