Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select join results
Message
From
28/04/2005 00:49:51
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01009098
Message ID:
01009100
Views:
23
>I have a select statement with a join condition that looks like this:
>
>
>SELECT a.acct_nbr, a.holder_num, b.h_name ;
>  FROM tmpCD a ;
>  LEFT JOIN holders b ON a.holder_num = b.h_num ;
>  INTO cursor tmpCursor
>
>
>The tmpCD file has about 1.25 million records. After running the select, the resulting cursor has 6 records more than the original tmpCD file....seems like it should be the same record count. None of the holder_num fields are empty. What am I missing here?

You'll get extra records in the result cursor if you have values in column tmpcd.holder_num that are not present in holders.h_num, not just if they are blank. You can pinpoint these records with
SELECT a.acct_nbr, a.holder_num ;
  FROM tmpCD a ;
  WHERE a.holder_num NOT IN (SELECT b.h_num FROM holders b) ;
  INTO CURSOR Orphans
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform