Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL join with empty data in one table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00392660
Message ID:
00392698
Vues:
10
>Hello,
>I need to make an SQL join of two tables, while data is missing in one of the two tables. Normally when I SELECT * FROM Table1 LEFT OUTER JOIN Table2 ON This=That , this is no problem, but in this case, I have in the WHERE clause something like:
>
>SELECT * FROM Companies Co LEFT OUTER JOIN Sales Sa ON Co.keyvalue = Sa.keybedra WHERE Sa.Price > 0 INTO CURSOR BadResult
>
>This results in a cursor that excludes all companies that have no corresponding records in the sales table, because of the Price>0 clause.
>What can I do about this? Changing the cursor name into GoodResult doesn't help either.

Try:
SELECT * ;
   FROM Companies Co ;
   LEFT OUTER JOIN Sales Sa ;
      ON Co.KeyValue = Sa.keyBedra AND ;
         Sa.Price > 0 ;
   INTO CURSOR GoodResult
My blog
My consulting page
My home page

Member of the Trim Your Auto-Quote Campaign!
What's another word for thesaurus?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform