0
I am developing a system in PHP and Mysql where a person does some overtime during the month.
pessoa = id - 5 - int /nome - 15 - varchar /
boletins = id -5 - int / idpessoa - 5 - int / horaextra - time / data - date /
I’d like to generate a report adding up everyone’s overtime all month, but I’m not getting it.
SELECT time_format( SEC_TO_TIME( SUM( TIME_TO_SEC( horaextra ) ) ),'%H:%i:%s') AS horaextra FROM boletins where idpessoa = (numero do id, mas queria listar todos com a hora somada do mes inteiro)
Use the GROUP BY idpessoa clause and the SUM aggregation function and the desired month/year condition.
– anonimo