basically,
i need to calculate hours worked.
currently i have a mysql database housing worker info in one table and the timesheet information in another table.
i am gathering the timesheet information into the following fields
id
workerid (from the worker table)
datein (injected with the php command date(Y-m-d)
timein(injected with the php command date(HⓂs)
dateout (same as above)
timeout (same as above)
i have a range of date that need to be calcuated in two different variables
$paystart = 2006-07-01;
$payend = 2006-07-15;
i need to select the entries in the timesheet table and
- sort them by worker id
- get the entries from within the range
- subtract $timein from $timeout in each entry
- total the result from 3 into a variable.
my main question is, is there a way to do this using a single sql statement?
or will i have to run multiple querys and process them through multiple loops?
i know this is a tough one.
also, if changing the way the timesheet data is housed would help in the math process i am willing to make any changes nessicarry.
thanks in advance.
chris