Inter-table query

JohnPapa

Registered User.
Local time
Today, 17:15
Joined
Aug 15, 2010
Messages
1,117
Assume table = tbl1 with one text field = str1 and table = tbl2 with one text field = str2. I would like to include in tbl1 all tbl2.str2, where tbl2.str2 value is not present in tbl1.str1.

For example if tbl1.str1 has values 5,6 and 7 and tbl2.str2 has values 7,8 and 9, then tbl1 should end up with values 5,6,7,8,9.

Is there a single query statement that can perform this task

Thanks,
John
 
John,

Try this out:

Code:
UPDATE tbl1 RIGHT JOIN tbl2 ON tbl1.str1 = tbl2.str2 SET tbl1.str1 = [tbl2].[str2]
WHERE (((tbl1.str1) Is Null));
 
Worked perfectly and is very fast. Many thanks.

I also added another assignment in the SET part of the query.
John
 
Last edited:

Users who are viewing this thread

Back
Top Bottom