Buenos dias a ver si me doy a entender tengo esta consulta
SELECT Num,timestampdiff(Minute,'2011-05-30T10:00:00','2011-05-30T10:15:00') as DifUno,
timestampdiff(Minute,'2011-05-30T15:00:00','2011-05-30T14:50:00')as DifDos,
timestampdiff(Minute,'2011-05-30T18:00:00','2011-05-30T18:00:00') as DifTres
FROM MiTabla where Num = 8 and campo_fecha > current_date;
que me envia la diferencia de minutos hasta aquí todo bien
Código:
Num DifUno DifDos DifTres
8 15 -10 0
yo quisiera al final mostrar un campo con el total algo asi
Código:
Num DifUno DifDos DifTres Total
8 15 -10 0 5
pero si hago esto asi
SELECT Num,timestampdiff(Minute,'2011-05-30T10:00:00','2011-05-30T10:15:00') as DifUno,
timestampdiff(Minute,'2011-05-30T15:00:00','2011-05-30T14:50:00')as DifDos,
timestampdiff(Minute,'2011-05-30T18:00:00','2011-05-30T18:00:00') as DifTres, (DifUno + DifDos + DifTres) as Total
FROM MiTabla where Num = 8 and campo_fecha > current_date;
obvio me marca error porque no tengo los campos en la tabla 'DifUno,DifDos etc..'
hay alguna manera de sacar eso el total de la diferencia??