• tommyh (9/6/2010)


    Hugo Kornelis (9/6/2010)


    Good question!

    In addition to your explanation, here is WHY an alias can be used in the ORDER BY, but not in the GORUP BY:

    Because Microsoft havent implemented it.

    We are allowed to use aliases in Group by (and other stuff) in the form of table aliases. Therefore there is no real reason for not allowing column aliases as well (well maybe a bit of performance).

    And who is we?

    On topic: nice question about the basics. And thanks for the explanation in depth Hugo.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP