I have a time clock application.
The timeclock table is:
id int(11)
userid varchar(25)
timein datetime
timeout datetime
worked decimal(4,2)
To get a list of the dates and time worked for each day for a pay period I can do:
Language: sql (GeSHi-highlighted)
SELECT `userid`, date(`timeout`), sum(`worked`) AS sum
FROM `timeclock`
WHERE `userid`='jdoe' AND date(`timeout`) BETWEEN '2008-03-26' AND '2008-04-10'
GROUP BY DATE(`timeout`)
ORDER BY `timeout`;
Can this be modified to also return the entire total sum of time worked without having to run another query?