Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT-SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00491132
Message ID:
00491133
Vues:
9
The only thing I can think of in this case is that maybe some of the records in nDebit1 are tagged as DELETEd ... you might
SELECT nDebit1
COUNT FOR NOT DELETED()
to find out.

By the way, a couple other issues with your SQL - I doubt these are causing the problem you mention, but they should be addressed:
1) The AND portion of the JOIN ON clause is not truly a JOIN condition at all. You should move that into the WHERE clause. (This might in fact cause the problem you mention, except that you said the problem still occurs when you remove the AND clause.)

2) Within that same AND clause, you have
bankname != "KEY" OR bankname != "UMB"
etc. This code will not filter any records ... every possible value of bankname satisfies this condition. You want either
bankname != "KEY" AND bankname !="UMB"
or
bankname = "KEY" OR bankname = "UMB"
And using the INLIST() function would make either option more readable.

Hope this helps!
zahid

>I have this code:
>
>SELECT nDebit1.*, companyid.bankname AS bank ;
>FROM nDebit1 LEFT OUTER JOIN companyid ;
>ON ALLTRIM(nDebit1.companyid) = ALLTRIM(companyid.companyid) ;
>AND (nDebit1.bankname!= "KEY" OR nDebit1.bankname!="UMB" ;
>OR nDebit1.bankname!="ZIONS" ) ;
>ORDER BY nDebit1.bankname ;
>INTO TABLE ndebit2
>
>I am trying to get the a table with the resulting bank name from the compnayid table but don't want all since companyid.companyid can be the same for some banks.
>
>nDebit1.dbf has 242 records in it. The nDebit2.DBF result ends up with 196 records. When I use the LEFT OUTER JOIN in some cases I get the same number of records I start with. In this case, I get less records. Is this a glitch in VFP?
>Even if I take the "AND" portion out of the "ON" I still get the same results. The help says I should get all of the records in the left table. Any idea what is happening here?
>
>
>Thanks in advance for your help.
>Randall
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform