I am working with a program in PHP
with connection to database MySQL
everything has gone well except in the section to get the total number of hours between two columns named Entry and Exit.
The program captures the hour of entry and exit of the employees, now what I want is that if in the hour of departure it takes more than 20 min
to leave and it meets an extra hour without salary, I mean that its hour of entry was at 9pm
and goes to 4pm suman
7Hrs
but if it takes and records 4:20pm
already counts as one hour more, that is, 8Hrs
in total.
To obtain the sum of the two columns of Hora_entrada
and Hora_salida
I do the following:
SELECT HOUR(SUM(TIMEDIFF(Hora_entrada, Hora_salida))) FROM control;
That gives me the total sum of hours worked, but I do not add the minutes.
In which part should I improve my query to add the minutes along with the hours of the 2 columns?