title: how to join two tables with one to many relationship
body: <p>I am using MS SQL Server 2008.</p>
  
  <p>I have two tables.</p>
  
  <p>The first one contains two columns of datetime type StartDate and EndDate and ProductID (int).</p>
  
  <p>The second table contains datetime column SaleDate and ProductID. </p>
  
  <p>What I am trying to accomplish is creation of a table, which would contain 
  ProductID, StartDate, EndDate, and NUMBER OF SALES FOR EACH PRODUCT ID making sure that only sales, that happened between the startDate and the EndDate are included in the resulting table. </p>
  
  <p>I am pulling data from the second  table grouping it by ProductID before the attempted join with the first table.</p>
  
  <p>Thanks in advance!</p>