Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start - Stop

Status
Not open for further replies.

Leeus

Programmer
Sep 10, 2001
40
GB
I have a SQL db that logs when a user dials in to our dial in account and then again stops the connection.
It logs the start time, and allocates a field with "Start" and one with "Stop" and a stop time when it finishes.

At the moment I have a query that looks at all of the events in a day, adds all the stops together, then all the starts and takes the difference, hopefully giving the cumulative time online for that one day! Problem I have is that some users stay online overnight so it throws my readings out.
Now to my question, is there a way of saying that if a username starts he day with a stop event to ignore that entry, likewise, end the day with a start.

Thanks all for your help.
 
These examples return number of minutes between the start and stop time. If you want to ignore the midnights, use:
Code:
select [start], [stop], (([stop] - [start]) * 1440) as [diff] from [time check] where [start] < [stop]

but to get all values, including midnight-crossers:
Code:
select [start], [stop], ((([stop] - [start]) * 1440) + iif([start] > [stop],1440,0)) as [diff] from [time check]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top