Re: Running totals on a select count statement

From: zack (anonymous_at_discussions.microsoft.com)
Date: 03/11/04


Date: Thu, 11 Mar 2004 11:41:12 -0800

Changed again

"where AR2.Creation_Date<= convert(Char(10), AR.Creation_Date, 101)" =>
"where AR2.Creation_Date-1<= convert(Char(10), AR.Creation_Date, 101)"

Working select=>
SELECT convert(Char(10), AR.Creation_Date, 101) AS DateWritten, COUNT(AR.Creation_Date) AS Written,
        (
                Select count(AR2.Creation_Date) from dbo.vw_Nothing AR2
                where AR2.Creation_Date-1<= convert(Char(10), AR.Creation_Date, 101)
        )
        as RunningTotal
FROM dbo.vw_Nothing AR
GROUP BY DATEPART(yy, AR.Creation_Date), DATEPART(mm, AR.Creation_Date), DATEPART(dd, AR.Creation_Date), CONVERT(Char(10), AR.Creation_Date, 101)