View Full Version : Joining one table to another table


dribblle
11-08-2004, 08:26 PM
Hi all

I am attempting to join one table to an another table to make one flat table. I appreciate that I can set up relationships between these two tables, however I need one flat table. I have been successful in using the "Make-Table" action query (creates a new table), but was hoping I would not have to apply this in conjunction with renaming the tables. I have read the help in Access on Action queries and the "Update" and "Append" sound ,in principle, like what I want, but do not appear to allow me to write back to an existing table.

Here is my scenario

Table_1
V_ID
Field10
Field11

Table_2
V_ID
Field01
Field02
Feild03

Table_2 joined to Table_1 on V_ID

Table_1
V_ID
Field10
Field11
Field01
Field02
Feild03

Any help would be much appreciated.

Regards

Russell

Pat Hartman
11-08-2004, 10:10 PM
I guess I don't understand why you need to permanently merge the tables. Are you certain that the relationship between them is 1-1? If it is, you can just use a query. In Access tables and queries are interchangable for most purposes. You can use queries within queries, you can export queries, you can use queries as the RecordSources for forms/reports, etc.

If you are obtaining data from multiple sources and want to combine it permanantly:
1. Decide which table will be the "master" table and add the columns from the "other" table to the "master" table.
2. To populate the columns, create an update query.
2a. Add the "master" table to the query,
2b. Add the "other" table to the query
2c. Join the two tables on the PK
2d. Select the target columns in the "master" table
2e. Change the query type to update
2f. In the "update to" cell, type the name of the source columns using the format - [othertablename].[columnname] - the square brackets are important.

When you run the update query, the new columns in the "master" table will be populated with the contents of the selected columns from the "other" table.