Update query?

G

Guest

I have 1 table named Anomaly and 1 table named QC. The anomaly table has the
fields X, Y, Target ID. The QC table has the fields X,Y, Target ID. The X,
Y fields are blank in the QC table. I want to make a query that will fill in
the X, Y fields in the QC table if the Target ID matches. How would I do
this?
 
G

Guest

The answer to your question is:

UPDATE QC INNER JOIN Anomaly
ON QC.[Target ID] = Anomaly.[Target ID]
SET QC.X = Anomaly.X, QC.Y = Anomaly.Y;

But the real question is why are you duplicating data like this?

Ken Sheridan
Stafford, England
 
G

Guest

Do I type that in the update to field in the query?

Ken Sheridan said:
The answer to your question is:

UPDATE QC INNER JOIN Anomaly
ON QC.[Target ID] = Anomaly.[Target ID]
SET QC.X = Anomaly.X, QC.Y = Anomaly.Y;

But the real question is why are you duplicating data like this?

Ken Sheridan
Stafford, England

Crystal said:
I have 1 table named Anomaly and 1 table named QC. The anomaly table has the
fields X, Y, Target ID. The QC table has the fields X,Y, Target ID. The X,
Y fields are blank in the QC table. I want to make a query that will fill in
the X, Y fields in the QC table if the Target ID matches. How would I do
this?
 
G

Guest

You have two options. You can simply switch from query design view to SQL
view and type the whole SQL statement in, or you can create a normal query in
design view, joining the two tables on the Target ID fields. Add just the X
and Y fields from the QC table to the design grid and then change it to an
Update query. In the 'Update to' row for each field enter Anomaly.X, or
Anomaly.Y as appropriate.

Ken Sheridan
Stafford, England

Crystal said:
Do I type that in the update to field in the query?

Ken Sheridan said:
The answer to your question is:

UPDATE QC INNER JOIN Anomaly
ON QC.[Target ID] = Anomaly.[Target ID]
SET QC.X = Anomaly.X, QC.Y = Anomaly.Y;

But the real question is why are you duplicating data like this?

Ken Sheridan
Stafford, England

Crystal said:
I have 1 table named Anomaly and 1 table named QC. The anomaly table has the
fields X, Y, Target ID. The QC table has the fields X,Y, Target ID. The X,
Y fields are blank in the QC table. I want to make a query that will fill in
the X, Y fields in the QC table if the Target ID matches. How would I do
this?
 

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

Top