Sql Synax Nightmare 
Author Message
 Sql Synax Nightmare

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
week.
 What is the best way of doing this?



Sun, 22 Apr 2001 03:00:00 GMT  
 Sql Synax Nightmare
Depending on your backend database, you'll need to do some kind of summary
sql code.

eg "select sum( logtable.logon - logtable.logoff ) where logtable.userid =
'whoever'

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.

HTH
John Townes
Sydney, Australia

Quote:

>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
>week.
> What is the best way of doing this?



Mon, 23 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL Nightmare

2. SQL statement nightmare!

3. SQL Nightmare

4. VBScript Function synax?

5. Findfirst's criteria string with single quote synax error

6. HighLight or Coloring HTML Synax in Visual Basic

7. Help: Redim synax

8. Nightmares with the apostrophe!!!!!!!!!!!!

9. My Worst Nightmare: Error Accessing File

10. VBE password nightmare

11. Control Nightmare

12. RegEx - my personal illogical nightmare

 

 
Powered by phpBB® Forum Software