• You should NEVER use BETWEEN with datetime data. Your query assumes a precision of 1 second when the actual precision of datetime data is 3 milliseconds, so you are missing everything between 00:00:00.003 and 00:00:00.997 and between 00:02:00.003 and 00:02:00.997. You are better off using semi-open date ranges (usually with the lower end closed and the top end open) such as

    WHERE YourDateField >= '2012-08-07 00:02:00'

    AND YourDateField < '2012-08-08 00:02:00'

    We encountered this at a former job, when the developer didn't take this into account. Fortunately, we were able to work around the problem.

    Drew

    PS: "Never" may be a bit extreme, but just barely.

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA