I am running latest MS office. In my .mdb database got two tables, table 1 and table 2. The flag in a record in table1 has to be reset if that record is not found in table 2. The two tables have different number of records. I run the following record and takes too much time. I have to cancel it before it finishes. What is the best solution/approach?. My left join solution did not yield in correct result. It did not find the record that was in table1 but not in table2.
Code:
update table
set table1.flag1 = 0
where not exist (select 1 from table2
where (NZ(table1.field1,"null") = NZ(table2.field1,"null")) AND
where (NZ(table1.field2,"null") = NZ(table2.field2,"null")) AND
where (NZ(table1.field3,"null") = NZ(table2.field3,"null")) AND
where (NZ(table1.field4,"null") = NZ(table2.field4,"null")) AND
where (NZ(table1.field5,"null") = NZ(table2.field5,"null")));