sql - access 2010 append data into table without overwriting existing records -
sorry long question/post need i've been searching several days havent found helps. seems should easy but..here goes
i have table1 in (access 2010) database has exising records. have table2 after run query, first deletes data in table 2, imports new records table. run import table 2 on semi regular basis have yet copy records table 1 successfully.
i need copy records table 2 table 1 if records don't exist in table1. so, each time query or vba code run, continuing grow table 1 without duplicating existing data.
to clarify further, it's data outlook gal each time table2 imports data (lname,fname,phone,email) needs added table1, if doesn't exist in table 1.
i have small start of sql cannot work because i'm not sure how add other fields sql statement (unfortunately don't know whole lot sql or creating append query):
insert [current] ( firstname ) select distinct tblglobaladdresslistimport.first tblglobaladdresslistimport left join [current] on tblglobaladdresslistimport.first = current.firstname current.firstname null;
how :
insert [current](firstname, lastname, phone, email) select distinct tblglobaladdresslistimport.first , tblglobaladdresslistimport.last , tblglobaladdresslistimport.phone , tblglobaladdresslistimport.email tblglobaladdresslistimport left join [current] on tblglobaladdresslistimport.first = current.firstname , tblglobaladdresslistimport.last = current.lastname , tblglobaladdresslistimport.phone = current.phone , tblglobaladdresslistimport.email = current.email current.firstname null , current.lastname null , current.phone null , current.email null;
adjust column names if guessed wrong. assumed don't have primary key, data in tblglobaladdresslistimport
considered exists if there row in current
having same value columns.
Comments
Post a Comment