Home Forums SQL Server 2008 T-SQL (SS2K8) trying to add alias for value generated by Where clause RE: trying to add alias for value generated by Where clause

  • Having looked at the article, it looks like the 'AS' clause is in the wrong place. It should be like this, I think

    SELECT a.DayCount,

    a.Sales,

    SUM(b.Sales) AS RunningTotal

    FROM Sales a

    CROSS JOIN Sales b

    WHERE (b.DayCount <= a.DayCount)

    GROUP BY a.DayCount,a.Sales

    ORDER BY a.DayCount,a.Sales