title: MySQL nested Select BETWEEN multiple rows
body: <p>I have 2 tables:<br />
  <em><strong>Table 1</strong></em> called calendar and have all dates and days<br />
  Example:</p>
  <pre><code>---------------------
  date       | day
  ---------------------
  2013-07-08 | Tuesday
  2013-07-09 | Wednesday
  </code></pre>
  <p>and so..</p>
  <p><em><strong>Table 2</strong></em> called &quot;events&quot; and have event start dates and end dates<br />
  Example:</p>
  <pre><code>-------------------------------------------
  title     | date        | end_date
  -------------------------------------------
  eventweek | 2013-07-08  | 2013-07-14
  </code></pre>
  <p>etc.</p>
  <p>Now I need to select the days between those dates which would be:</p>
  <pre><code>SELECT days
  FROM   calendar
  WHERE  date BETWEEN
                       (
                       SELECT date
                       FROM   events
                       WHERE  title LIKE %eventweek%)
  AND
         (
                SELECT end_date
                FROM   events
                WHERE  title LIKE %eventweek%).
  </code></pre>
  <p>Now the problem is when there is multiple &quot;eventweek&quot; titled events like this:</p>
  <pre><code>-------------------------------------------
  title     | date        | end_date
  -------------------------------------------
  eventweek | 2013-07-08  | 2013-07-14
  eventweek | 2014-07-01  | 2014-07-13
  </code></pre>
  <p>of course I will get &quot;subquery returns more than 1 row&quot;.</p>
  <p>Expected results in this example are the days between 2013-07-08 and 2013-07-14 plus the days 2014-07-01 and 2014-07-13 and every future &quot;eventweek&quot; tagged entry.</p>
  <p>Btw this gonna be a table view so maybe can't be solved with a loop. Any ideas?</p>
  <p><strong>Thanks a lot</strong> for any suggestion, I will try them all to see the simpler and faster one.</p>