Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Interview questions
Message
 
 
À
25/05/2009 13:13:57
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01380550
Message ID:
01462786
Vues:
95
>>>As a follow-up, the "why" is becuase the result (with the alias name) hasn't been created.....
>>>
>>>That's why you can use expression aliases in an ORDER BY....becuase the result set has already been created (sort of), and the database engine can refer to any alias names. But prior to that (i.e. in a GROUP BY), it's too early to use aliases.
>>
>>Now I see.
>>
>>For instance, you can use Row_Number() result in ORDER BY but not in the WHERE expression, AFAIK.
>
>I have in my notes processing in this order (my notes are old though so it may not be true anymore):
>
>1. From clause
>2. Where clause
>3. Group By Clause
>4. Having Clause
>5. Select clause (this is where the alias names come to 'be.')
>(Left out order by which is operated on the cursor so it would be #6)
>
>Can anyone update it? Is it different now? This is from 2004.

Here is a nice poster by Itzik Ben-Gan

http://www.solidq.com/insidetsql/books/insidetsql2008/Logical%20Query%20Processing%20Poster.pdf
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform