Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL on Two Tables where All Fields Match
Message
 
 
To
05/07/2001 10:45:17
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00526958
Message ID:
00527271
Views:
47
This message has been marked as a message which has helped to the initial question of the thread.
>Is there a way to write SQL to find all the records in TableB that match every field in TableA? There are 200+ fields in both tables (same structures) with about less than 100 records in TableA and 200,000 in TableB. I'm trying to do a nested select using the distinct clause, but I can't seem to get either the syntax or the result right. Psuedo code something like:
>
>select * from TableA where AllFields not in (select AllFields from TableB)into cursor Result
>
>...or can I compare arrays somehow?
>
>Thanks!
>
>Regards, Renoir

Since you have only ~100 records in tableA, I would use Nick's idea and scan TableA. If you would have 200000 rec. in both tables, the scan would be slower than SQL. See thread "Comparing" for some ideas. Also then you construct your SQL, you can create several variables, like lcWhere1, lcWhere2, etc., where each portion is less than 255 chars. Another alternative would be construct whole SQL command in a string (or String1 ;
String2 ;
String3;) still in one string, then strtofile(myTempPrg), compile MyTempPRg, do myTempPrg.

Hopefully you got an idea.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform