Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using SQL to select unique records in 1 file from another
Message
From
09/11/1999 17:24:04
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Using SQL to select unique records in 1 file from another
Miscellaneous
Thread ID:
00289322
Message ID:
00289322
Views:
71
I've got a program that records all internet usage activity at our company. The program appends this information to a delimited text file. I have a VFP program that imports this into a table, that can be queried and reported on.
To acomplish this, currently I append all the information into a temporary file, then relate this temporary file to the original table, and delete all records that are already in the original like so :
use logfile in 0 shared order keyfield
copy structure to tempfile
use tempfile in 0 exclusive
select tempfile
append from (TextImportFile) type delimited
set relation to keyfield into logfile additive
delete all for not eof("logfile")
pack
select logfile
append from tempfile
use in tempfile
delete file tempfile.dbf

This works, but since the keyfield is actually a combination of several different typed fields, it requires a complex index and relation that is problematic. My question is this : Is there a way of using a select statement to select just the new items to be added.

I tried this :
select * from tempfile where tempfile.keyfield # logfile.keyfield
But this gives every combination between the two files that don't match. This is not what I want, I just want to know what records are in the tempfile that are not already in the logfile.

Anyone got any suggestions?
Next
Reply
Map
View

Click here to load this message in the networking platform