copy all values to different existing record

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

Guest

I need a query to take all the values from one record (except the Key field)
and put those values into corresponding fields of a second record in the same
table.

What is the cleanest way to do this?
 
An append query would be the way to go. What type of field is your
primarykey? Is it an autonumber?

INSERT INTO YourTable ([KeyField], FieldA, FieldB, FieldC,...)
SELECT "ABC124", FieldA, FieldB, FieldC,..
FROM YourTable
WHERE KeyField= "ABC123"

If the keyfield is an autonumber then leave it out of the field lists. If
the PK is some other value then you will have to supply it by some means.
 
Try something like:

UPDATE Table1 As Dest, Table1 As Src
SET Dest.[FieldX] = Src.[FieldX],
Dest.[FieldY] = Src.[FieldY] ...
WHERE Dest.[KeyField] = 123
AND Src.[KeyField] = 456
 

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

Back
Top