Update Querry

oscarooko

Registered User.
Local time
Today, 00:28
Joined
Oct 18, 2005
Messages
18
Hello,
This may sound too common a question, but I really need help on it. Prior querries in the same do not seem to solve it.

I have two tables, table1 and table2 with the following fields
table1 ( ACID, name, address, Salary, MStatus,Age)
table2 ( ACID,salary, Age)

ACID is the common field in the two tables ( primary key in table1)

Required

I need to update table1 with the colums in table2 for all the similar ACID in in table1.

Basically, after teh update, table1 will have all the information it had before the update, but a few fields will have changed coz of teh new information coming from table2.

Please help with the code. I'm using access, and the table structures are all the same.

Thanks in advance
 
try:
UPDATE Table1
SET Salary = (Select Salary from table2 where table2.ACID = table1.ACID),
Age = (Select Age from table2 where table2.ACID = table1.ACID)
WHERE ACID in (Select distinct ACID from table2);
 

Users who are viewing this thread

Back
Top Bottom