How I can update one table from another WHERE ...?

haris

Registered User.
Local time
Today, 02:28
Joined
Feb 12, 2002
Messages
13
Hello!

I have two tables Table1 and Table2. Both tables have same type fields FieldA and FieldB. In Table1 both fields FieldA and FieldB are filed, but in Table2 just FieldA and FieldB is empty. Field FieldA in Table1 is PrimaryKey for FieldA in Table2.

PROBLEM IS:
How I can automaticaly using SQL copy data from FieldB in Table1 to empty field FieldB in Table2 where FieldA in both tables equal.

Thank you!
 
Try this for an update query:

UPDATE table1 INNER JOIN table2 ON table1.fieldA= table2.fieldA SET table2.fieldB = table1.fieldB;

If by running it automatically you mean to run it from code, you can run this upate query using a querydef object. Look in Help under querydef for help in coding that part of it.

HTH
 

Users who are viewing this thread

Back
Top Bottom