Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select question
Message
 
 
À
02/06/2003 09:45:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00794895
Message ID:
00795242
Vues:
20
>>It was strange to me too that it works. Because I have never before used this syntax. I thought that JOIN can only use something like
>>ON TABLE1.FIELD = TABLE2.FIELD.
>>
>>I hope I am not doing something that I will later regret when using syntax:
>>
>>
>>Select * from MYTABLE1 join MYTABLE2 on MYTABLE1.FLD1 = MYTABLE2.FLD2 and MYTABLE2.SOMEDATE between (BEGINDATE and ENDDATE)
>>
>>
>>I hope someone who knows more about correct SQL Select will warn me of the potential problem.
>
>Actually, this is exactly the right solution. This is a question I cover when I do sessions on queries. The general rule of thumb is that if the condition affects which records come into the query via the outer join, it belongs in the JOIN clause. If the condition is intended to filter out records _after_ the outer join (for example, if you only wanted parts of a certain type), put it in the Where clause.
>
>Tamar

Thank you for your explanation.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform