Merge data from part of one table into a larger table.

  • Thread starter Thread starter Taz
  • Start date Start date
T

Taz

Hello Group,

I have a large table (tablemain) with numerous fields and a primary key
named (keynumber). Some fields were originally created with the anticipation
of populating them with data later. Later is now. For example I have a field
named street address in (tablemain). There are around 500 records and of
those, only 10% or so have data in the street address field. I have another
table created by an external query of another database called (tablesmall)
that uses the same primary key (keynumber) as (tablemain) and has the street
address field complete for each record. I need to populate the street
address field of (tablemain) using (tablesmall's) data. I can't simply copy
the field over because it then wipes out any changes or existing data in
(maintable). How can this be done? I though I might be able to do it with
some sort of update query but it has not worked. Keep in mind I am a novice
so I don't know any scripting. A non-script solution would be greatly
appreciated.

Thank you in advance.
 
Hello Ta
What you require is an UPDATE query which looks something lik
UPDATE <tablename> SET <field1> = <value1>,<field2> = <value2> WHERE <tablename>.<keyfield> = <sourcetable>.<keyfield

As a newbie I strongly recommend that you create a play database and try this using the query builder. Create a new query, select the main table plus the source table (tablesmall). Link the two tables on the key field. Select the fields you want to update from the main table.
From the Query menu select UPDAT
In the UPDATE TO boxes put both the tablename and field name of the appropriate field in the source table eg
[tablesmall].[fieldname
Have fu
Terr

----- Taz wrote: ----

Hello Group

I have a large table (tablemain) with numerous fields and a primary ke
named (keynumber). Some fields were originally created with the anticipatio
of populating them with data later. Later is now. For example I have a fiel
named street address in (tablemain). There are around 500 records and o
those, only 10% or so have data in the street address field. I have anothe
table created by an external query of another database called (tablesmall
that uses the same primary key (keynumber) as (tablemain) and has the stree
address field complete for each record. I need to populate the stree
address field of (tablemain) using (tablesmall's) data. I can't simply cop
the field over because it then wipes out any changes or existing data i
(maintable). How can this be done? I though I might be able to do it wit
some sort of update query but it has not worked. Keep in mind I am a novic
so I don't know any scripting. A non-script solution would be greatl
appreciated

Thank you in advance
 
Thank you for the help. I will give it a shot.


Terry said:
Hello Taz
What you require is an UPDATE query which looks something like
UPDATE <tablename> SET <field1> = <value1>,<field2> = <value2> WHERE
As a newbie I strongly recommend that you create a play database and try
this using the query builder. Create a new query, select the main table plus
the source table (tablesmall). Link the two tables on the key field. Select
the fields you want to update from the main table.
From the Query menu select UPDATE
In the UPDATE TO boxes put both the tablename and field name of the
appropriate field in the source table eg
[tablesmall].[fieldname]
Have fun
Terry

----- Taz wrote: -----

Hello Group,

I have a large table (tablemain) with numerous fields and a primary key
named (keynumber). Some fields were originally created with the anticipation
of populating them with data later. Later is now. For example I have a field
named street address in (tablemain). There are around 500 records and of
those, only 10% or so have data in the street address field. I have another
table created by an external query of another database called (tablesmall)
that uses the same primary key (keynumber) as (tablemain) and has the street
address field complete for each record. I need to populate the street
address field of (tablemain) using (tablesmall's) data. I can't simply copy
the field over because it then wipes out any changes or existing data in
(maintable). How can this be done? I though I might be able to do it with
some sort of update query but it has not worked. Keep in mind I am a novice
so I don't know any scripting. A non-script solution would be greatly
appreciated.

Thank you in advance.
 
Back
Top