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

  • laurie-789651 (8/1/2012)


    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

    AFAIK, there is no such thing as an 'AS' clause in T-SQL.

    In the code you provide, the 'AS' can be omitted.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.