• I don't know the whole structure of your table, but this might give you something to start.

    You might need to add some fields or add the extra time to get the 00:59:50.

    Be aware that BETWEEN is inclusive for both values, so you might have values that get in two days.

    CREATE TABLE #PSACCESSLOG(

    opridvarchar(6),

    logindttmdatetime)

    INSERT INTO #PSACCESSLOG

    SELECT 'jbaker', '2012-06-01 00:50:59.000' UNION ALL

    SELECT 'jbaker', '2012-06-01 12:50:59.000' UNION ALL

    SELECT 'jbaker', '2012-06-01 15:50:59.000'

    SELECT oprid,

    DATEADD( dd, DATEDIFF( dd, 0, LOGINDTTM), 0) AS LOGINDT,

    COUNT(*) AS entries

    FROM #PSACCESSLOG

    WHERE LOGINDTTM BETWEEN '2012-06-01 00:50:59.000' AND '2012-07-01 00:50:59.000'

    GROUP BY oprid, DATEADD( dd, DATEDIFF( dd, 0, LOGINDTTM), 0)

    ORDER BY OPRID, LOGINDT

    DROP TABLE #PSACCESSLOG

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2