Correlated Sub-queries
update customers set stat = “A”
where o.custid = customer.custid
and o.cmpny = customers.cmpny
update customers set stat = “A”
where o.custid = customers.custid
and o.cmpny = customers.cmpny
If orders has only 20 rows meeting the filter, the second version of the update runs much faster, assuming that customers has an index on the column custid.
The orginal CSQ is left since it was joining on more than one column