Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using JOIN ON vs WHERE
Message
 
 
À
13/01/2009 15:02:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01373343
Message ID:
01373396
Vues:
18
All conditions for tables in LEFT JOIN have to go to the AND clause for the right table and for the RIGHT JOIN all conditions on the left table should also go to the AND in JOIN. Otherwise it would make the JOIN to be an inner join.

>I have the following query
>SELECT fieldlist GROUP BY etc.;
>FROM PoItems ;
>        INNER JOIN PoMain ON pomain.ponum = poitems.ponum ;
>        INNER Join SupInfo On PoMain.UniqSupNo = SupInfo.UniqSupNo ;
>        INNER join Newfields ON newfields.uniq_key = PoItems.Uniq_key ;
>        LEFT Outer Join PoItSchd On PoItems.UniqLnNo = PoItSchd.UniqLnNo ;
>   WHERE PoItems.uniq_key = lcUniqKey AND Not EMPTY(PoItems.ponum) AND NOT poitems.lCancel;
>   HAVING cond
>
>I typically try to write my queries so that the JOIN parts only show the joining criteria and put selection criteria into WHERE
>
>In this case, would it be better to move any/all parts of the WHERE clause into the JOIN?
>
>In this case, execution speed is not really a consideration but I'm wondering if there is a potential difference in the result set.
>
>Thanks to all.........Rich
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform