I have two tables A and B each table has three fields 1,2 and 3.
What i need to do is update table A field 3 with the value of table B field 3 where A.1 = B.1 and A.2 = B.2 The problem is i have know idea of the SQL statment i need to achive this.
Printable View
I have two tables A and B each table has three fields 1,2 and 3.
What i need to do is update table A field 3 with the value of table B field 3 where A.1 = B.1 and A.2 = B.2 The problem is i have know idea of the SQL statment i need to achive this.
In case of msSQL
VB Code:
update TableA set TableA.FieldC = TB.fieldC from TableA TA, TableB TB where TA.PrimKey = TB.ForeignKey
Try something like this:
UPDATE Table_A
SET Table_A.Field_3 = Table_B.Filed_3
WHERE Table_A.Field_1 = Table_B.Field_1
AND Table_A.Field_2 = Table_B.Field_2
doofusboy, that is the method i have tried but it just requests a value for TableA.Field_1.
I forgot to add that i am using Access
Make sure the criteria would return only one record from table B.
I dont want to update just one record, i want to update all the matching records.
"but it just requests a value for TableA.Field_1."
Then Field_1 is not a fieldname in TableA
Try this MS Access syntax
Code:UPDATE TableA
INNER JOIN TableB ON TableB.Field1 = TableA.Field1 And TableB.Field2 = TableA.Field2
SET TableA.Field3 = TableB.Field3;