title: Group by date and and check for continuous dates
body: <p>I have a set of data like this</p>
  
  <pre><code>date1       Price  Availability  ServiceID
  2012-10-01  50     1             5
  2012-10-02  60     1             5
  2012-10-03  60     1             5
  2012-10-04  60     1             5
  2012-10-06  60     1             5
  2012-10-07  60     0             5
  2012-10-08  60     1             5
  </code></pre>
  
  <p>Now I want to check what is the total price, min availability and serviceid for a particular period</p>
  
  <p>For example</p>
  
  <pre><code>from 2012-10-01 to 2012-10-03 results would be 170, availability 1 and serviceID 5
  from 2012-10-06 to 2012-10-08 results would be 180, availability 0! and serviceID 5
  from 2012-10-04 to 2012-10-06 results would be 120, availability 1! and serviceID 5 BUT there is a date missing so availability is 0!
  </code></pre>
  
  <p>I tried something like</p>
  
  <pre><code>select date1, sum(price), min(availability), service from #t
  group by date1, price, availability, service
  having count(date1) = datediff(day, @startdate, @enddate)
  </code></pre>
  
  <p>That does not work because if I group by date1, then count in not valid. Dont know how to get sum, min availability and check continuous dates.</p>
  
  <p><strong>EDIT</strong>
  In case I want a results set to contain detailed spec. and filter out results with min(availability) = 0 or noncontinuous date</p>
  
  <pre><code>For example
  from 2012-10-01 to 2012-10-03 results would be 170, availability 1 and serviceID 5
  
  date1       Price  Availability  ServiceID
      2012-10-01  50     1             5
      2012-10-02  60     1             5
      2012-10-03  60     1             5
  
  from 2012-10-06 to 2012-10-08 results would be 180, availability 0! and serviceID 5
  date1       Price  Availability  ServiceID
  
  from 2012-10-04 to 2012-10-06 results would be 120, availability 1! and serviceID 5 BUT 
  date1       Price  Availability  ServiceID
  </code></pre>