I need totals of a table grouping by date....
My Table is:
Empleado_Horas_Labor(....,EMPLEADO,Fecha,Horas_Normales,....)
The result is:
Fecha
--------------------------- -----------------
2004-02-01 00:00:00.000 8.0
2004-02-02 00:00:00.000 10.0
2004-02-03 00:00:00.000 10.0
2004-02-04 00:00:00.000 10.0
2004-02-05 00:00:00.000 10.0
2004-02-06 00:00:00.000 8.0
2004-02-08 00:00:00.000 8.0
.......
.......
2004-02-26 00:00:00.000 10.0
2004-02-27 00:00:00.000 8.0
2004-02-29 00:00:00.000 8.0
(27 row(s) affected)
***********************
I want a result like this:
Fecha
--------------------------- -----------------
2004-02-01 00:00:00.000 8.0
2004-02-02 00:00:00.000 10.0
2004-02-03 00:00:00.000 10.0
2004-02-04 00:00:00.000 10.0
2004-02-05 00:00:00.000 10.0
2004-02-06 00:00:00.000 8.0
2004-02-07 00:00:00.000 NULL
2004-02-08 00:00:00.000 8.0
.......
.......
2004-02-26 00:00:00.000 10.0
2004-02-27 00:00:00.000 8.0
2004-02-28 00:00:00.000 NULL
2004-02-29 00:00:00.000 8.0
(29 row(s) affected)
HAVING ALL DAYS OF THE MONTH in the result set
Thanks
My Table is:
Empleado_Horas_Labor(....,EMPLEADO,Fecha,Horas_Normales,....)
Code:
SELECT Fecha,SUM(Horas_Normales) FROM Empleado_Horas_Labor
WHERE EMPLEADO = '02-061' GROUP BY Fecha
The result is:
Fecha
--------------------------- -----------------
2004-02-01 00:00:00.000 8.0
2004-02-02 00:00:00.000 10.0
2004-02-03 00:00:00.000 10.0
2004-02-04 00:00:00.000 10.0
2004-02-05 00:00:00.000 10.0
2004-02-06 00:00:00.000 8.0
2004-02-08 00:00:00.000 8.0
.......
.......
2004-02-26 00:00:00.000 10.0
2004-02-27 00:00:00.000 8.0
2004-02-29 00:00:00.000 8.0
(27 row(s) affected)
***********************
I want a result like this:
Fecha
--------------------------- -----------------
2004-02-01 00:00:00.000 8.0
2004-02-02 00:00:00.000 10.0
2004-02-03 00:00:00.000 10.0
2004-02-04 00:00:00.000 10.0
2004-02-05 00:00:00.000 10.0
2004-02-06 00:00:00.000 8.0
2004-02-07 00:00:00.000 NULL
2004-02-08 00:00:00.000 8.0
.......
.......
2004-02-26 00:00:00.000 10.0
2004-02-27 00:00:00.000 8.0
2004-02-28 00:00:00.000 NULL
2004-02-29 00:00:00.000 8.0
(29 row(s) affected)
HAVING ALL DAYS OF THE MONTH in the result set
Thanks