Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Continuation of Message #1594531 - Use of WHERE
Message
From
23/02/2014 14:50:01
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01594922
Message ID:
01595005
Views:
40
>>>There is one important problem in this code sample - the OrderDate is not prefixed with the alias. Without that we would need to check which table this column belongs to.
>>>My rule of thumb - prefix every column with an alias name when the query involves more than 1 table.
>>
>>I don't disagree with the rule of thumb, especially with several tables. But with 2 tables (a business entity master and a child table of orders), any question about the lineage of OrderDate is more likely a problem with the person in the chair. :)
>>
>
>The rule is the rule - and I always follow it.

My rule says that all fields within a database have a unique name by having a three letter prefix and an underscore for every field in a table, therefore not needing to prefix any field with an alias. As a bonus in the result of the query you always know where the field comes from.

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform