Good day all,
I need some assistance on how to finish this query.
Above I am summing clock in and clout out times in a timeclock system. This works great, but I would also like to show each clock in and clock out record before displaying the sum for that employee.
SELECT hours.empid, SUM(TIME_TO_SEC(TIMEDIFF(hours.clockout, hours.clockin))) as timecalc, employees.employeeid, employees.firstname, employees.lastname, employees.class FROM hours, employees WHERE hours.empid = employees.employeeid AND hours.clockin BETWEEN '$_POST[startdate]' AND '$_POST[enddate]' GROUP BY hours.empid ORDER BY hours.empid DESC
Can I loop through each employees records, display them, and then display the summed results at the end, then onto the next employee and so on?
I hope that makes sense!