moving selected data from table_1 to table_2 via querry?

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

Table 1 has fields A, B, C, X
Table 2 has fields A, C, Z

- I want to to import some records from Table 2 to Table 1 as new records.
- I want to import only fields A and C from Table 2 to Table 1 (the two
common fields)
- I want fields B & X to remain blank in the new records in Table 1

If I create a query on Table 2 to select the proper records...

How can I get the data from the query added to Table 1 as new records as
described above?

Thanks for any help on this.
 
Will said:
Table 1 has fields A, B, C, X
Table 2 has fields A, C, Z

- I want to to import some records from Table 2 to Table 1 as new records.
- I want to import only fields A and C from Table 2 to Table 1 (the two
common fields)
- I want fields B & X to remain blank in the new records in Table 1

If I create a query on Table 2 to select the proper records...

How can I get the data from the query added to Table 1 as new records as
described above?

Build a query in Query Designer on Table2 to get field A and C, and then
change it into an Append Query. Choose Table1, and it should automatically
fill in the "Append To" fields for you, since the column names match. Let us
know if you'd prefer the SQL for the quaery to do this...
 
David,

I would like the SQL for reference if it is not too much of a problem.

I will also try your suggested solution using the append query.

Additionally, and for the info of others interested, I found if I do a query
on Table 1 and an identical query on Table 2...

Then I can copy and paste records from query 1 to the end of query 2... and
that copies the desired records from table 1 to table 2.

Will
 
I would like the SQL for reference if it is not too much of a problem.

Sure, here it is:
INSERT INTO [Table 1] ( A, C )
SELECT [Table 2].A, [Table 2].C
FROM [Table 2];
Additionally, and for the info of others interested, I found if I do a query
on Table 1 and an identical query on Table 2...

Then I can copy and paste records from query 1 to the end of query 2... and
that copies the desired records from table 1 to table 2.
Yeah, that's basically what the query is doing - you are a bit reliant on the
formats being correct, as I'm not sure if text -> number conversions etc work
via the clipboard...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top