title: mysql select from table a where condition x and subselect
body: <p>I want to count the amount of registries in table A to an specific amount of time determined at table B.</p>
  
  <p>I am looking for the proper way of do something like this:</p>
  
  <pre><code>SELECT count(*) as total
  from table_a as a
  WHERE a.created &gt;= '0000-00-00 00:00:00'
  AND a.created &lt;= (SELECT table_b.end WHERE table_b.id = 13)
  </code></pre>
  
  <p>Basically, table_b consists of 3 columns: an int primary key named 'id', a datetime named 'start', and an other datetime named 'end'. This is the way I have identified all the weeks of the current year.</p>