SELECT T1.FECHA, T2.VALOR FROM TABLA T1 INNER JOIN ( SELECT T3.FECHA, ( SELECT SUM(ISNULL(T4.VALOR,0)) FROM TABLA T4 WHERE T4.FECHA BETWEEN '2008-12-1' AND T4.FECHA AND T3.FECHA >= T4.FECHA ) AS VALOR FROM TABLA T3 WHERE T3.FECHA BETWEEN '2008-12-1' AND '2008-12-31' ) T2 ON T2.FECHA = T1.FECHA
No hay comentarios:
Publicar un comentario