title: How can I identify groups of consecutive dates in SQL?
body: <p>Im trying to write a function which identifies groups of dates, and measures the size of the group.</p>
  
  <p>I've been doing this procedurally in Python until now but I'd like to move it into SQL.</p>
  
  <p>for example, the list</p>
  
  <pre><code>Bill 01/01/2011 
  Bill 02/01/2011 
  Bill 03/01/2011 
  Bill 05/01/2011 
  Bill 07/01/2011 
  </code></pre>
  
  <p>should be output into a new table as:</p>
  
  <pre><code>Bill 01/01/2011  3 
  Bill 02/01/2011  3 
  Bill 03/01/2011  3 
  Bill 05/01/2011  1 
  Bill 07/01/2011  1
  </code></pre>
  
  <p>Ideally this should also be able to account for weekends and public holidays - the dates in my table will aways be Mon-Fri (I think I can solve this by making a new table of working days and numbering them in sequence). Someone at work suggested I try a CTE. Im pretty new to this, so I'd appreciate any guidance anyone could provide! Thanks.</p>