Al sumar datos tipo TIME encontré un problema cuando supera a 838:59:59, ya que tiene un rango va de -838:59:59 a 838:59:59, Cuando es inferior es fácil
Código sql:
para solucionarlo hice esto, pero la verdad no me convenceVer original
SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(tothra)))AS 'HORAS_TOTALES' FROM hratra
Código sql:
Si alguien tiene una mejor forma o pude mejorar la que ya tengo seria estupendo.Ver original
SELECT CONCAT( ( SELECT IF( ( SUM( SUBSTR( tothra, INSTR( tothra, ':' ) +1 ) ) ) > '59', SUBSTRING( (SUM( SUBSTR( tothra, INSTR( tothra, ':' ) +1 ) ) /60 ) , 1, INSTR( (SUM( SUBSTR( tothra, INSTR( tothra, ':' ) +1 ) ) /60 ) , '.' ) -1) + ( SUM( SUBSTRING( tothra, 1, INSTR( tothra, ':' ) -1 ) ) ) , SUM( SUBSTRING( tothra, 1, INSTR( tothra, ':' ) -1 ) ) ) ), ':', ( SELECT IF( ( SUM( SUBSTR( tothra, INSTR( tothra, ':' ) +1 ) ) ) > '59', MOD( SUM( SUBSTR( tothra, INSTR( tothra, ':' ) +1 ) ) , 60 ) , SUM( SUBSTR( tothra, INSTR( tothra, ':' ) +1 ) ) ) ) ) AS 'HORAS_TOTALES' FROM hratra
Les agradezco mucho si me pueden colaborar, muchas gracias de antemano