Append only new records

  • Thread starter Thread starter bhammer
  • Start date Start date
B

bhammer

This must be simple, but . . .

INSERT INTO tblComponents.Component
SELECT Component
FROM tblComponentsDefault
WHERE tblComponentsDefault.Component <> tblComponents.Component;

I get an enter parameter dialog.

I simply have a default list of components in one, unrelated table
that the user can choose to append to the "real" components table (the
one with relationships to other tables), if they choose to. The user
may have no entries, or many entries in tblComponents, so I simply
want to add from the default list and avoid duplicates. The ID does
not come into play here, so . . . ?
 
Try this --
INSERT INTO tblComponents.Component
SELECT Component
FROM tblComponentsDefault LEFT JOIN tblComponents ON
tblComponentsDefault.Component = tblComponents.Component
WHERE tblComponents.Component IS NULL;
 
Back
Top