Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


SQL Server 2005 Table Alias in Order By

Posted on 2008-11-17
Medium Priority
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

jogos earned 150 total points
ID: 22974723
Column alias is a problem, not table alias

Author Closing Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

577 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