title: Mysql DELETE from table using information from another table
body: <p>So I have these two tables:</p>
  <p><a href="https://i.stack.imgur.com/4A2zY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4A2zY.png" alt="img" /></a><br />
  <sub>(source: <a href="http://gyazo.com/284ffb2d834ab5aa25ced78fbd30c77c.png" rel="nofollow noreferrer">gyazo.com</a>)</sub></p>
  <p>The Sites table holds all types of websites to vote on, and Voted_sites table contains all of the sites that been voted on.</p>
  <p>Now, sites should get deleted from Voted_sites, when the current date is greater than <code>date_voted + interval vote_wait_time_hours</code>.</p>
  <p>So in my case I would do it like this:</p>
  <pre><code>DELETE FROM voted_sites 
  LEFT JOIN sites ON voted_sites.site_id = sites.id 
  WHERE voted_sites.date_voted &lt; NOW() - INTERVAL sites.vote_wait_time_hours HOUR
  </code></pre>
  <p>But unfortunately it gives my syntax error, because I am guessing that you can't use <code>LEFT JOIN</code> like that in a delete query.</p>
  <p>Basically I need to grab the <code>vote_wait_time_hours</code> from <code>sites</code> that has the same id key.</p>