Skip to content

Instantly share code, notes, and snippets.

@StaniTr
Created January 30, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StaniTr/bd2375743affcc3ec1b5 to your computer and use it in GitHub Desktop.
Save StaniTr/bd2375743affcc3ec1b5 to your computer and use it in GitHub Desktop.
Entries LOGON Only (w/o LOGOFF)
SELECT Session_ID, TIMESTAMP, datediff(DAY, puzzsessions.TIMESTAMP, sysdatetime()) daysLogged --logOn time - (current)system time
FROM puzzSessions
--logon
WHERE ActionName='LOGON' AND session_id NOT IN
-- no LOGOFF
(SELECT Session_ID
FROM puzzSessions
WHERE ActionName='LOGOFF')
ORDER BY TIMESTAMP DESC --login from 15th and 16th dec 2014 :)))
--RESULT: 31 IDs - 3 LOGONs w/o LOGOFF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment