Depending on your backend database, you'll need to do some kind of summary
eg "select sum( logtable.logon - logtable.logoff ) where logtable.userid =
Also, be aware that having a boolean for loggedOn is dangerous - what
happens if either the client app or (heaven forbid <g> ) the server crashes?
The user will be left unable to log in, being told they are already logged
in, as there was no gracefull exit from the client app.
>I need to get the hours worked in a particular week. I have a table with 3
>fields: userID( type integer), time(type date),
> and loggedOn (type boolean).
>The employee has many records of his logging in and out.
>He can't log out, if he's already out, and he can't log in if he's already
>in. This part works fine. All I need to do is access the data. He comes and
>goes several times a day.
>I need to calculate how many hours he was logged on during any particular
> What is the best way of doing this?