FoxPro Programming
sql insert and delete in same query
Gravatar is a globally recognized avatar based on your email address. sql insert and delete in same query
  Harvey Mushman
  All
  Mar 24, 2018 @ 07:50am

Let's say I have a table MailingLists and I want to update the table to only include a new definition of who should be included. This means deleting people that don't belong and adding those not already present.

One solution would be to DELETE ALL and then INSERT FROM newList but this has two drawbacks, lost history of the entries being deleted that in the end will be included in the final result and it requires several steps to determine how new entries are being added since the insert would include all from the newList.

We in VFP don't have a MERGE command but maybe it is not needed...

Is there a single select statement that can handle both the DELETE and INSERT in one commend line ?

© 1996-2024