Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/05/2011, 11:12
leonardo_josue
Colaborador
 
Fecha de Ingreso: enero-2007
Ubicación: México
Mensajes: 2.097
Antigüedad: 17 años, 10 meses
Puntos: 447
Respuesta: duda sumar el total de una diferencia de minutos

Hola Markgus:

Puedes hacerlo de dos formas:

Código MySQL:
Ver original
  1. SELECT T.*, DifUno+DifDos+DifTres total FROM
  2. (
  3. Num,
  4. timestampdiff(Minute,'2011-05-30T10:00:00','2011-05-30T10:15:00') DifUno,
  5. timestampdiff(Minute,'2011-05-30T15:00:00','2011-05-30T14:50:00') DifDos,
  6. timestampdiff(Minute,'2011-05-30T18:00:00','2011-05-30T18:00:00') DifTres
  7. FROM MiTabla where Num = 8 and campo_fecha > current_date
  8. ) T
  9.  
  10. Num,
  11. timestampdiff(Minute,'2011-05-30T10:00:00','2011-05-30T10:15:00') DifUno,
  12. timestampdiff(Minute,'2011-05-30T15:00:00','2011-05-30T14:50:00') DifDos,
  13. timestampdiff(Minute,'2011-05-30T18:00:00','2011-05-30T18:00:00') DifTres,
  14. timestampdiff(Minute,'2011-05-30T10:00:00','2011-05-30T10:15:00') +
  15. timestampdiff(Minute,'2011-05-30T15:00:00','2011-05-30T14:50:00') +
  16. timestampdiff(Minute,'2011-05-30T18:00:00','2011-05-30T18:00:00') total
  17. FROM MiTabla where Num = 8 and campo_fecha > current_date

Haz la prueba y nos comentas.

Saludos
Leo.