I have employee table for attendance and i have a test select statement to get the total hours of employee:
and now i want to insert the sum of hours per employee in time database with the employee no.Code:select sec_to_time(SUM(unix_timestamp(timeout) - unix_timestamp(timein))) AS totalhours from employee;
here is my code:
INSERT INTO time (empno,total)
SELECT EMP_NO,sec_to_time(SUM(unix_timestamp(timeout) - unix_timestamp(timein)))
GROUP BY EMP_NO;
no data inserted in time database. What's erong in my query?