title: SQL query to select values from a table where the condition is from related tables
body: <p>I'm struggling to write a SELECT query in my PHP application. The situation is following: </p>
  
  <p>I have table ADDRESS with one-to-many relation to table CONTEST. The relation is via junction table ContestHasAddress. CONTEST table has many-to-many relation to DATE table via junction table ContestHasDate.</p>
  
  <p>I was trying to SELECT all columns from ADDRESS table WHERE the column1 from DATE related to its CONTEST (who is related to the ADDRESS) is bigger then a specific VALUE. I have attached the linke below showing the relation view from phpmyadmin. </p>
  
  <p>I tried that but it was a failure</p>
  
  <pre><code>SELECT address.*
  FROM address,
       contest,
       date
  WHERE address.contest.dates[0].start_time &gt; TIMESTAMPVALUE 
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/PepsA.png" alt="Link showing the table design"></p>