Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax help
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL syntax help
Miscellaneous
Thread ID:
00868355
Message ID:
00868355
Views:
60
Hi,

Is there adequate SQL syntax for the next problem.

One table InOut. It contains information when employer is logged in and out from the work. During one day employer can log multiple time in and out. All timestamps (datetime) when logged in and out is converted to the seconds (UDF) since midnight and summed togethere to get total seconds in work which is then calculated and converted to hours for the report.
Sys(3009,70)
Select Inout.cid, InOut.tdate, InOut.iInOrOut...;
  Sum(tToSec(InOut.tdate)*iif(InOut.iInOrOut=1,1,0)) As Sum_In, ;
  Sum(tToSec(InOut.tdate)*iif(InOut.iInOrOut#1,1,0)) As Sum_Out, ;
...
Where InOut.tdate>=m.tStart AND ;
InOut.tdate<=m.tEnd ;
Group By InOut.tdate, InOut.cid
.
Now I have to have a field there to to show how many days employers has been in work between m.tStart and m.tEnd. Using plain Count may not be the option (?) because he/she can be logged in/out multiple time (one log is one record) per day.

AT
Next
Reply
Map
View

Click here to load this message in the networking platform