Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting from one table to another
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00800915
Message ID:
00800934
Views:
18
VFP7 and earlier
select last, .t. AS volunteer, person AS oldid ;
  from volunteer;
  where Person not in (select oldId from person);
  into CURSOR Temp
select person
append from ( DBF("Temp"))
USE IN Temp
VFP8
INSERT INTO person (last,first,volunteer,oldid);
SELECT (volunteer.last,volunteer.first,.t.,volunteer.person) ;
FROM volunteer ;
WHERE volunteer.person NOT IN (select oldid FROM person)
>In "there must be a way" department....
>
>I'm trying to copy volunteers from an old table, to a new table. Some of the records from the old table already exist in the new table.
>
>I'm looking to use a single SQL statement to insert records from one table that don't have a corresponding record in another table. something like:
>
>INSERT INTO person (last,first,volunteer,oldid);
>VALUES (volunteer.last,volunteer.first,.t.,volunteer.person);
>WHERE volunteer.person NOT IN (select oldid as person FROM person)
>
>
>Right now, I'm doing this with SCAN-ENDSCAN....and locate....the old dBase syntax.
>
>TIA
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform