THe script below is used to display the number of calls closed yesterday, but obviously the SQL statement being used is taking the past 24 hours. How can I amend this so it only takes yesterdays calls (obviously MySQL uses the time in the field as well) and also to let me use todays date to work out how many today. <% SQL="SELECT Count(CallReference) as CallCount FROM supportv3 WHERE Status = 'CL' and call_closer = 'Dave Francis' AND last_update > DATE_SUB(NOW(), INTERVAL 1 DAY)" set CallCount=conn.execute(SQL) If trim("" & CallCount(0)) = "" then CallCount3=0 Else CallCount3 = CallCount(0) End IF %> <%=CallCount3%>
You will need to add an upper limit, try: WHERE Status = 'CL' and call_closer = 'Dave Francis' AND last_update > DATE_SUB(CURDATE(), INTERVAL 1 DAY) AND last_update < CURDATE()