Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why?????
Message
De
29/05/2003 04:55:16
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00793822
Message ID:
00793838
Vues:
30
This message has been marked as the solution to the initial question of the thread.
>Why I get different sets of records:
>
>Table1 (Name C(40), Key1 N(4), ...)
>Table2 (Text C(60), Key1N(4), ChildKey C(100))
>cChild = "000100050004"+SPACE(88)
>
>1.)
>SELECT Table1.*,Table2.Name AS T2Name FROM Table1 LEFT JOIN Table2 ON Table1.Key1 == Table2.Key1 WHERE Table2.ChildKey <> cChild INTO CURSOR Test
>
>Here I get ALL the records from Table1 but the field T2Name is NULL for those records where Table2.ChildKey <> cChild
>
>
>2.)
>SELECT Table1.*,Table2.Name AS T2Name FROM Table1 LEFT JOIN Table2 ON Table1.Key1 == Table2.Key1 WHERE .NOT. Table2.ChildKey == cChild INTO CURSOR Test
>
>Here I get filtered records from Table1.
>
>Why?

Both should return same filtered records from table1 (no nulls). In VFP6 and prior however nulls would return in both. This was corrected in VFP7.

PS: With == in SQL you don't need to pad or trim variable to match length. ie:
cChild = "000100050004"
cChild1 = "000100050004"+space(88)
where myField == cChild
and :
where myField == cChild1
are same.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform