title: MsSQL / Classic ASP - Select statement from time a to time b
body: <p>I have quite a complex query that i need to expand but am not sure how to go about it.</p>
  
  <p>At the moment, im using the following query to output a few values.</p>
  
  <pre><code>SELECT CONVERT(CHAR(8), pay.PaidUntil, 10) as LastDay, 
         COUNT(*) As PaymentsDue, 
         SUM(sales.Amount) As TotalDue 
  FROM UserPaidUntil pay INNER JOIN Sales sales 
   ON pay.Sales_ID = sales.Sales_ID 
  WHERE pay.PaidUntil &gt; getDate() 
   AND pay.PaidUntil &lt; DateAdd(day, 10, getDate()) 
   AND pay.Billing_ID = 2 
  GROUP BY CONVERT(CHAR(8), pay.PaidUntil, 10) 
  ORDER BY CONVERT(CHAR(8), pay.PaidUntil, 10)
  </code></pre>
  
  <p>At the moment, this script get values between 2 dates, 10 days apart and then groups them by their date.</p>
  
  <p>Now what i need to do is change the sql so that each day is actually from 10:01am on day A through to 10:00am on day B</p>
  
  <p>The UserPaidUntil.PaidUntil is the field that has the dates</p>
  
  <p>Im not sure where to start so i thought i would ask if anyone could help me.</p>
  
  <p>Cheers</p>