0
I’m doing the following query:
SELECT SEC_TO_TIME(sum(Total_Segundos_Consumidos)/count(distinct IDTRANSACTIONS)) AS `Tempo Médio`
FROM
(SELECT IDTRANSACTIONS,
SUM(TIME_TO_SEC(TimeDiff(TIME_FORMAT(DATEFIM,'%H:%i'),
TIME_FORMAT(DATEINI,'%H:%i')))) AS Total_Segundos_Consumidos
FROM TEMPO
GROUP BY IDTRANSACTIONS) AS Q
And it’s not working.
The following error appears:
Bad format for Time '-05:46:27.2727' in column 1
This is because running only the inside command brings negative numbers:
-80340, -86040
Examples in http://sqlfiddle.com/#! 9/8cedc9/11
My goal is to take the attendance time and extract an average of the time. In the link above, I put the times of one of the users to serve as an example.
is it possible to have this negative time? is not wrong the calculation intern what are you doing?
– rLinhares
Use the ABS (Absolute) function that will not occur: SUM(abs(TIME_TO_SEC(...
– Andre Mesquita