title: SQL Count Of Open Orders Each Day Between Two Dates
body: <p>I've tried searching but it's likely I'm using the wrong keywords as I can't find an answer.</p>
  
  <p>I'm trying to find the number of orders that are open between two dates and by employee. I have one table that shows a list of employees, another that shows a list of orders that contains an open and close date and also a dates table if that helps. </p>
  
  <p>The employee and order tables joined will return something like:</p>
  
  <pre><code>employee    order ref   opened          closed
  a           123         01/01/2012      04/01/2012
  b           124         02/01/2012      03/01/2012
  a           125         02/01/2012      03/01/2012
  </code></pre>
  
  <p>And I need to transform this data into:</p>
  
  <pre><code>Date            employee    Count
  01/01/2012      a           1
  02/01/2012      a           2
  02/01/2012      b           1
  03/01/2012      a           2
  03/01/2012      b           1
  04/01/2012      a           1
  </code></pre>
  
  <p>I'm pulling the data from SQL server.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>
  
  <p>Nick</p>