Dear, I have a table with a TIME-type column, which stores the time worked on the day, and I'm trying to add these times to the end of a month, but with no success.
I used the following query:
Query 1:
SELECT TIME_FORMAT((SELECT sum(TOTAL)
FROM horario where PRESTADOR='NOME'
and MONTH(data) = 1 and YEAR(data) = 2015), '%H:%i:%s') as total;
"null" result;
Query 2:
SELECT SEC_TO_TIME( SUM( TIME_TO_SEC(TOTAL))) AS total_horas
FROM horario where PRESTADOR='NOME' and MONTH(data) = 1 and YEAR(data) = 2015;
Result "6.14: 24: 00";
Query 3:
SELECT sum(TOTAL)
FROM horario where PRESTADOR='NOME'
and MONTH(data) = 1 and YEAR(data) = 2015;
Result: "1526400"; The correct result would be 158: 24: 00