Using an update query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables and I want to add the columns from one table to the main
table. All I have to do it link the tables by a common field, correct? Then
put the fields that I want to add into the query, correct? But, this is just
a query with a one to one relationship??? So, what exactly does an update
query do and how do you use it??? I tihink I am thinking way to much into
this....
 
T said:
I have two tables and I want to add the columns from one table to the main
table. All I have to do it link the tables by a common field, correct? Then
put the fields that I want to add into the query, correct? But, this is just
a query with a one to one relationship??? So, what exactly does an update
query do and how do you use it??? I tihink I am thinking way to much into
this....

UPDATE is used to modify existing records. I suspect what you want is
INSERT (also known as an "append" query). You don't really need to join
the tables unless you are trying to filter the selection, e.g., to
eliminate duplication of existing records.

It's pretty simple really,

INSERT INTO MyBigTable (Field1, Field2, ...)
SELECT FieldA, FieldB, ...
FROM MySmallTable

I suggest writing everything from SELECT on down first (you can do this
in the query builder), make sure you get the results you want, then
(switch to SQL view and) add the INSERT INTO bit.

Check out INSERT in help for other ways to use the statement.

HTH
 
Back
Top