Answer the question
In order to leave comments, you need to log in
Zeroing a table field if the value from another field is not in the second table?
There are two tables
table1 (about two million records): id name state
table2 (about 50 thousand records): name
each has many columns, but only those are of interest.
Two questions:
1. The bottom line is that in table1 you need to periodically set state to NULL if name is not in table2. How can this be done? According to SQL, I remember only the very, very simple basics, and googled only confuses.
2. How can you reduce the load on the database as much as possible (that is, do not lock it for a long time)?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question