title: select from table between dates and count duplicates
body: <p>I have a table named <code>tblOrders</code></p>
  
  <pre><code>| ID  | name    | email      | amount  | date       |
  +-----+---------+------------+---------+------------+
  | 1   | danny   | dan@email  | $10.00  | 06/01/2015 |
  | 2   | bryan   | bra@email  | $50.00  | 06/01/2015 |
  | 3   | jenny   | jen@email  | $20.00  | 06/02/2015 |
  | 4   | gabby   | gab@email  | $35.00  | 06/02/2015 |
  | 5   | lisa    | lisa@email | $12.00  | 06/03/2015 |
  | 6   | don     | don@email  | $23.00  | 06/04/2015 |
  | 7   | danny   | dan@email  | $22.00  | 06/04/2015 |
  | 8   | bryan   | bra@email  | $55.00  | 06/05/2015 |
  | 9   | danny   | dan@email  | $69.00  | 06/20/2015 |
  | 10  | danny   | dan@email  | $49.00  | 06/25/2015 | 
  </code></pre>
  
  <p>I want to select from <code>tblOrders</code> between date <code>06/03/2015</code> and <code>06/25/03/2015</code>
  and then count the number of repeated customers I have.</p>
  
  <p>Select between date <code>06/03/2015</code> and <code>06/25/03/2015</code> provides</p>
  
  <pre><code>| ID | name  | email      | amount | date        |
  +----+-------+------------+--------+-------------+
  | 5  | lisa  | lisa@email | $12.00 | 06/03/2015  |
  | 6  | don   | don@email  | $23.00 | 06/04/2015  |
  | 7  | danny | dan@email  | $22.00 | 06/04/2015  |
  | 8  | bryan | bra@email  | $55.00 | 06/05/2015  |
  | 9  | danny | dan@email  | $69.00 | 06/20/2015  |
  | 10 | danny | dan@email  | $49.00 | 06/25/2015  |
  </code></pre>
  
  <p>Then checking by <code>email</code> from those records if exist in all <code>tblOrders</code> and count
  This should provide count of <code>2</code> as there are 2 customers between those dates that ordered before.</p>
  
  <p>How can I achieve that with one SQL query?</p>
  
  <p>I'm using Access database and ASP classic</p>
  
  <p>My current code is</p>
  
  <pre><code>ReturnCustomers = 0
   Set rs = Server.CreateObject("ADODB.Recordset")
   SQL = ("select ID,Email,OrderDate from tblOrders Where OrderDate between #"&amp;date1&amp;"# and "&amp;date2&amp;";")
   rs.Open SQL,Cnn,3,1
   Do while Not rs.EOF
  
    Set rsCount = Server.CreateObject("ADODB.Recordset")
    SQL = ("select ID from tblOrders Where Email='"&amp;rs("Email")&amp;"' and Not ID="&amp;rs("ID")&amp;";")
    rsCount.Open SQL,Cnn,3,1
    IF Not rsCount.EOF Then
     ReturnCustomers = ReturnCustomers+1
    End IF
    rsCount.Close
    Set rsCount = Nothing
  
   rs.MoveNext
   Loop
   rs.Close
   Set rs = Nothing
   response.write ReturnCustomers
  </code></pre>
  
  <p>How can I do this one in 1 SQL query?</p>