In MySQL,
update table1 t1
set column1 = 100,
column2 = 200
where column3 > 500
and not exists(select *
from table2
where column1 = t1.column1);
This query is too time consuming to execute, do have any other faster way of rewriting.
for table2 ID is a primary column so i guess i can rewrite as
update table1 t1
set column1 = 100,
column2 = 200
where column3 > 500
and not exists(select ID
from table2
where column1 = t1.column1);
but still the query takes 2 secs to run, i want something in millisecs.