Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding LEFT JOIN
Message
De
23/08/2005 13:02:16
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01042886
Message ID:
01042994
Vues:
31
This message has been marked as a message which has helped to the initial question of the thread.
>>
>>SELECT Billing_charges.*, Viscodes.ccode_description;
>> FROM ;
>>     Billing_charges ;
>>    LEFT OUTER JOIN VisCodes ;
>>   ON  Viscodes.ccode_value LIKE ( Billing_charges.crevenue_code+"%" );
>>  AND Viscodes.ccategory_description LIKE ( "REVENUE_CODES%" )
>> WHERE  Billing_charges.cbilling_main_fk = ( ?vp_cBilling_main_fk )
>>
>
>These two queries are supposed to be the same. Can you explain the difference between these two? It looks like yours works every time, while the original with IsNull sometimes fails to work. I can not understand it.

The difference is about timing. When you move the condition to the JOIN clause, VFP checks the category description before performing the outer join, so Billing_Charges records that fail that test get added to the result.

With the condition in the WHERE clause, they're not filtered out until after the join, so no extra records are added.

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform