update a
 set a.a2=1
from a,b
where a.a1=b.b1