Hi all,
I need to create an UPDATE query that updates tableB (destination) with the data from tableA (source) and that does not create an extra line for each change in the table.
Here is the break down:
two tables with matching id's
tableA (source) has 6 columns and about 700 lines
tableB (destination) has 18 columns and also about 700 lines
There will be roughly about 95 changed fields
I would like to:
Update tableB with the data from tableA by id's
Do this without adding extra lines (for changes in lines with matching id's)
Only add a line to tableB if there is a new ID in tableA
What I have done so far:
Created an update query
Added both the source and destination tables to the query
Created a 1 to 1 relationship between the ID's
Added the names of the destination fields to the Field row of the query design grid
Added the names of source fields to the Update To row of the query design grid by using the following syntax:
.[source_field]
This results in a list that for some reason creates an extra line for each change found.
Here is my SQL so far:
I think I am close but being new to access it's been a pain figuring this out. Thank you.
I need to create an UPDATE query that updates tableB (destination) with the data from tableA (source) and that does not create an extra line for each change in the table.
Here is the break down:
two tables with matching id's
tableA (source) has 6 columns and about 700 lines
tableB (destination) has 18 columns and also about 700 lines
There will be roughly about 95 changed fields
I would like to:
Update tableB with the data from tableA by id's
Do this without adding extra lines (for changes in lines with matching id's)
Only add a line to tableB if there is a new ID in tableA
What I have done so far:
Created an update query
Added both the source and destination tables to the query
Created a 1 to 1 relationship between the ID's
Added the names of the destination fields to the Field row of the query design grid
Added the names of source fields to the Update To row of the query design grid by using the following syntax:
This results in a list that for some reason creates an extra line for each change found.
Here is my SQL so far:
Code:
UPDATE [1e tbl_Select Current Month TEMP] INNER JOIN [Copy Of tbl_Select Current Month] ON [1e tbl_Select Current Month TEMP].[ID] = [Copy Of tbl_Select Current Month].[ID] SET [Copy Of tbl_Select Current Month].Country = [1e tbl_Select Current Month TEMP].[Country], [Copy Of tbl_Select Current Month].[Business Unit] = [1e tbl_Select Current Month TEMP].[Business Unit], [Copy Of tbl_Select Current Month].[Corporate Job Title] = [1e tbl_Select Current Month TEMP].[Corporate Job Title], [Copy Of tbl_Select Current Month].[Reports To] = [1e tbl_Select Current Month TEMP].[Reports To], [Copy Of tbl_Select Current Month].Territory = [1e tbl_Select Current Month TEMP].[Territory];
I think I am close but being new to access it's been a pain figuring this out. Thank you.
Last edited: