Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement
Message
 
To
11/02/2007 11:21:15
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
01194505
Message ID:
01194565
Views:
9
>Hi
>
>>I hate this because when you use a very complicated statement which takes many rows and you are in WHERE clause sometimes you can't remember which tables is A, which is B etc. Better use aliases with more letters that will tell you with what table you work. If the table name is smaller than 10 letter then don't use alias at all. This is of course only my opinion.
>
>when you comment i think of that, i read sometime ago, here or in other place i don't remember now where, that's better to prefix the tables, for better reading and not make some confusion when tables as same fields names, where clauses like you said, i only do this's in test queries and small ones... for not writing alot :) ...
>
>By the way ... i think your sample works...thank's, move them to the real place and see ...
>
>João Batista

O, don't get me wrong here. I use aliases, but they have more than 3 letters in it :-) If you works with more that one DB and your query looks like this:
SELECT MyDatabase1.dbo.TableName.Somefield,
       MyDatabase2.dbo.TableName.OtherField
FROM MyDatabase1.dbo.TableName
LEFT JOIN MyDatabase2.dbo.TableName ON ...
Better use this:
SELECT DB1TableName.Somefield,
       DB2TableName.OtherField
FROM MyDatabase1.dbo.TableName DB1TableName
LEFT JOIN MyDatabase2.dbo.TableName DB2TableName
     ON ...
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform