title: How to create a sql query with ranges from unrelated table in ms access?
body: <p>I have an ms access 2010 database with two unrelated tables: Days and Periods. Like these:</p>
  
  <pre><code>Days
  -----
  Day (Date)
  Value (Integer)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Periods
  -----
  PeriodNum (Integer)
  StartDate (Date)
  EndDate (Date)
  </code></pre>
  
  <p>I want to get a new table, like this:</p>
  
  <pre><code>Periods_Query
  -----
  PeriodNum (Integer)
  Value (Integer) - sum of all Values from table Days, where Day is in between 
                    StartDate and EndDate
  </code></pre>
  
  <p>I tried to build an SQL query, but i don't know how to get ranges. Tried somethig like this but it didn't work:</p>
  
  <pre><code>SELECT Period, Sum(Value) FROM Days, Periods;
  </code></pre>
  
  <p>So, is there a way to build such a query?</p>
  
  <p>Thanks.</p>