SQL Server 2005 Table Alias in Order By

Posted on 2008-11-17
Last Modified: 2012-05-05
Understand that SQL Server 2005 does not support table alias in order by clause
but I tried with SQL server 2005 at my development server, it works!
I wonder why
example as below
select a.UserID, a.ParentUserID, a.UserName, b.AccountName
from User a
inner join UserDetails b on a.UserID = b.UserID
order by b.AccountID -- AccountID is something not exists in select statement but in table b

and I check the database compatibility level, it is set to 2005 (90)
Question by:saimor
    LVL 25

    Accepted Solution

    Column alias is a problem, not table alias

    Author Closing Comment

    ah ha... only now i realise there is table & column alias. Thanks for pointing out.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
    I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now