Just a hint:

Given the user 'User' and given no missing login/logout event logging you
can retrieve the total amount in seconds he was logged on with the following
formula:

SELECT

(SELECT SUM(time_to_sec(time_stamp)) as logoutTime from logevents where
event='logout' and userid='User' )

-

(SELECT SUM(time_to_sec(time_stamp)) as loginTime from logevents where
event='login' and userid='User')

this can surely be developed with grouping by user and filtering by time,
this is just the basic function.
Cheers
Claudio

2009/4/1 Tom Scheper <sche...@gmail.com>

> Hi,
>
> I have a table like so
>
> id autoinc
> userid int
> action enum ('login', 'logout' )
> timestamp
>
> --
>
> Is it possible to perform a mysql query that gets the total logged in
> time for any one user on any one particular day/week/month? And how?
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=claudio.na...@gmail.com
>
>

Reply via email to